3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $so = new \stdClass; $so->a = 1; $obj = new \stdClass(); $obj->z = $so; $arr = array(new \stdClass(), array('a' => 1, 'b' => $so, 'c' => $obj), $so); $result = @json_encode($arr, 0, 4);
based on NFROo
Output for 5.3.0 - 7.2.0
Output for 4.3.0 - 4.3.1, 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/rgv2f on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/rgv2f on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/rgv2f on line 9
Output for 4.3.2 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/rgv2f on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/rgv2f on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/rgv2f on line 9
Process exited with code 255.