It is used easy function for php bignners.
Below Show 3 methods
Method 1 :
It is used to substr(0 function
<?php
first create any name with any content
$content = "Content display x words in PHP function Content display x words in PHP function Content display x words in PHP function Content display x words in PHP function Content display x words in PHP function Content display x words in PHP function";
SUBSTR($content, 0, STRPOS($content, "." ,100)+1);
?>
Method 2 :
<?php
if(strlen($content) > 10)
$short = substr($content),0,100."....";
?>
Method 3 :
<?php
$charset = 'UTF-8';
$length = 100;
if(mb_strlen($content, $charset) > $length)
{
$short = mb_substr($content,0,$length,$charset).".....";
}
?>
Sign up here with your email