3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if(!function_exists('json_encode'))die(); $types = array( 'boolean' => true, 'integer' => 1, 'double' => 2.2, 'NULL' => NULL); foreach ($types as $key => $type) { echo "$key: var_export>" . var_export($type, 1) . " json_encode>" . json_encode($type) . "\n"; }
Output for 5.2.0 - 5.4.21, 5.5.0 - 5.5.5, hhvm-3.10.0 - 3.12.0, 7.1.0
boolean: var_export>true json_encode>true integer: var_export>1 json_encode>1 double: var_export>2.2 json_encode>2.2 NULL: var_export>NULL json_encode>null
Output for 5.6.28, 7.0.14
boolean: var_export>true json_encode>true integer: var_export>1 json_encode>1 double: var_export>2.2000000000000002 json_encode>2.2 NULL: var_export>NULL json_encode>null
Output for 5.4.22 - 5.4.45, 5.5.6 - 5.6.24, 7.0.0 - 7.0.9
boolean: var_export>true json_encode>true integer: var_export>1 json_encode>1 double: var_export>2.20000000000000017763568 json_encode>2.2 NULL: var_export>NULL json_encode>null
Output for 4.3.0 - 5.1.6