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, array($obj)), $so); $result = @json_encode($so, 0,1); var_dump($result, json_last_error(), json_last_error_msg());
based on L6qRP
Output for 5.5.0 - 7.2.0
string(7) "{"a":1}" int(0) string(8) "No error"
Output for 5.3.0 - 5.4.45
Fatal error: Call to undefined function json_last_error_msg() in /in/3qV51 on line 13
Process exited with code 255.
Output for 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3qV51 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3qV51 on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3qV51 on line 9 Fatal error: Call to undefined function json_last_error() in /in/3qV51 on line 13
Process exited with code 255.
Output for 4.3.2 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3qV51 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3qV51 on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3qV51 on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3qV51 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3qV51 on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3qV51 on line 9