I want to drop off decimals without rounding up. For example if I have 1.505, I want to drop last decimal and value should be 1.50. Is there such a function in PHP?
Its easy and work better.
$value = 12.9987876; $value_exp = explode(".", $value); $value_new = floatval($value_exp[0].'.'.substr($value_exp[1],0,4)); echo $value_new; // output will 12.9987