note 106508 deleted from function.substr by danbrown
| From: | danbrown@php.net | Date: | Tue, 15 Nov 2011 16:17:07 +0000 |
| Subject: | note 106508 deleted from function.substr by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184463@lists.php.net to get a copy of this message | ||
Note Submitter: Maddy Vora
----
<?php
// here is the sample code for substr with the use of strip_tags
// munirsunni@gmail.com
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;
}
?>