3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(json_encode(['price' => 45.0]), JSON_PRESERVE_ZERO_FRACTION);
based on 3bu5T
Output for 5.6.6 - 7.2.0
string(12) "{"price":45}" int(1024)
Output for 5.4.0 - 5.6.5
Notice: Use of undefined constant JSON_PRESERVE_ZERO_FRACTION - assumed 'JSON_PRESERVE_ZERO_FRACTION' in /in/mOPte on line 3 string(12) "{"price":45}" string(27) "JSON_PRESERVE_ZERO_FRACTION"