Limit Length of Text in PHP
Ok say you have a title like this:
“This is a long title for a story this is a title wow.”
And you want to have a excerpt from it.
Such as “This is a long title” instead of the whole thing
We would use the PHP substr function, which goes like this.
<?$test is the text to clip, the 0 is where is starts in the phrase (0 makes it the beginning), while 25 is the amount of letter to clip.
$test = "your text here adding length here";
echo "".substr($test, 0, 25)."";
?>
This would make it say “your text here adding len”.
Then you could add to the end off the echo a …
like this:
echo "".substr($test, 0, 25)."...";







