<?php
$fpname = '{{hotel_name}}';
echo $fpname;
?>
Output is 'Eggless Blackforest Cake Half Kg'
$fname = '<b>'.substr($fpname,0,10); if(strlen($fpname) > 10) $fname .= '...'; $fname .= '</b>';
Output is as below
Eggless Blackforest Cake Half Kg
Now my query is how can i show a part of the string ....
Expected output is
Eggless Bl...
Everything looks fine,
$fpname = "Eggless Blackforest Cake Half Kg";
$fname = '<b>'.substr($fpname,0,10); if(strlen($fpname) > 10) $fname .= '...'; $fname .= '</b>';
echo $fname;
See Demo here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.