Shortening a string
Reduces the string size according to the parameter that has been send and put '...' at the end of the new string
Copy this code and paste it in your HTML
function short($txt,$size){
$short = $size - 3;
$data = substr( $txt, 0, $short )."..."; }
else
{
$data = $txt;
}
return $data;
}
echo short('Gianino Cole',10);
Report this snippet
Comments
Subscribe to comments