3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function xpnd($scientific, $precision){ # expand from scientific notation if(is_int($scientific)){ #don't convert integers return $scientific; } return sprintf("%.".$precision."F", $scientific); } function exp2int($exp) { list($mantissa, $exponent) = spliti("e", $exp); if($exponent=='') return $exp; list($int, $dec) = split("\.", $mantissa); bcscale (abs($exponent-strlen($dec))); return bcmul($mantissa, bcpow("10", $exponent)); } echo "1 - ".bcdiv(0.0000967, 2, 10)."\n"; echo "2 - ".(40075036/86164.098903691)."\n"; echo "3 - ".bcdiv(xpnd(0.0000967, 10), 2, 10)."\n"; echo exp2int("1.5"); \\1.5
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting identifier (T_STRING) in /in/WcLKH on line 20
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_NS_SEPARATOR, expecting T_STRING in /in/WcLKH on line 20
Process exited with code 255.