note 106493 modified in function.strip-tags by danbrown
| From: | danbrown@php.net | Date: | Tue, 15 Nov 2011 16:28:38 +0000 |
| Subject: | note 106493 modified in function.strip-tags by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184476@lists.php.net to get a copy of this message | ||
Here is the function created for strip tags with sub string
<?php
function displaySubStringWithStrip($string, $length=NULL)
{
if ($length == NULL)
$length = 50;
$stringDisplay = substr(strip_tags($string), 0, $length);
if (strlen(strip_tags($string)) > $length)
$stringDisplay .= ' ...';
return $stringDisplay;
}
?>
--was--
//Here is the function created for strip tags with sub string
<?php
function displaySubStringWithStrip($string, $length=NULL)
{
if ($length == NULL)
$length = 50;
$stringDisplay = substr(strip_tags($string), 0, $length);
if (strlen(strip_tags($string)) > $length)
$stringDisplay .= ' ...';
return $stringDisplay;
}
?>
http://php.net/manual/en/function.strip-tags.php