3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $number = 17.48; $number = intval(($number*10))/10; echo $number; // x.0 if x.1,x.2,x.3 ; x.5 if x.4,x.5,x.6 ; x+1.0 if x.7,x.8,x.9 $whole = floor($number); //integer part $decimal = $whole - $number; // decimal part echo $decimal;
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
17.4-0.4