function kilomega( $val ) {
if( $val < 1000 ) return $val;
$val = (int)($val/1000);
if( $val < 1000 ) return "${val}k";
$val = (int)($val/1000);
return "${val}m";
}
I want to set that function into my result data in table :
echo "<td class='td'>kilomega($sum_qty9)</td>";
But facing problem, the result of the echo to be :
kilomega(5000) should be 5k
Any advice ?
Function calls are not interpolated in a string so
echo "<td class='td'>kilomega($sum_qty9)</td>";
should change to
echo "<td class='td'>",kilomega($sum_qty9),"</td>";
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.