3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if(!defined('JSON_FORCE_OBJECT')) { echo 'unsupported version'; return; } $j0 = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0; $j1 = $j0 | JSON_FORCE_OBJECT; foreach( array( array() ) as $i) { echo json_encode($i, $j0); }
based on TFj5v
Output for 7.1.0
Notice: Use of undefined constant  JSON_FORCE_OBJECT - assumed ' JSON_FORCE_OBJECT' in /in/0Qmvv on line 8 Warning: A non-numeric value encountered in /in/0Qmvv on line 8 []
Output for 5.3.0 - 5.3.29, 5.4.28 - 5.4.45, 5.5.12 - 7.0.14
Notice: Use of undefined constant  JSON_FORCE_OBJECT - assumed ' JSON_FORCE_OBJECT' in /in/0Qmvv on line 8 []
Output for 5.4.0 - 5.4.27, 5.5.0 - 5.5.11
Notice: Use of undefined constant  JSON_FORCE_OBJECT - assumed ' JSON_FORCE_OBJECT' in /in/0Qmvv on line 8 [ ]
Output for 4.3.0 - 5.2.17
unsupported version