The Number helper contains functions useful when working with numbers.
Loading the Helper
$nh = Loader::helper(‘number’);
Methods
$r = $nh->flexround($value);
When given a numeric $value, rounds the value only out to its most significant digit.
print $nh->flexround(‘4.250’); // outputs 4.25 print $nh->flexround(‘5.1’); // outputs 5.1 print $nh->flexround(‘4.000’); // outputs 4
Loading Conversation