3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(json_encode(10.0)); var_dump(json_decode(json_encode(10.0, JSON_PRESERVE_ZERO_FRACTION)) === 10.0);
based on lvZ3D
Output for 5.6.6 - 7.2.0
string(2) "10" bool(true)
Output for 5.4.0 - 5.6.5
string(2) "10" Notice: Use of undefined constant JSON_PRESERVE_ZERO_FRACTION - assumed 'JSON_PRESERVE_ZERO_FRACTION' in /in/DKodl on line 5 Warning: json_encode() expects parameter 2 to be long, string given in /in/DKodl on line 5 bool(false)