3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $exception = new \exception(uniqid()); $reference = & $exception; var_dump(spl_object_hash($reference) === spl_object_hash($exception)); var_dump(spl_object_hash($reference) === spl_object_hash($exception = new \exception(uniqid()))); $exception = spl_object_hash($exception = new \exception(uniqid())); var_dump(spl_object_hash($reference) === spl_object_hash($exception));
based on 2E18e
Output for 5.3.0 - 7.2.0
bool(true) bool(false) Warning: spl_object_hash() expects parameter 1 to be object, string given in /in/noTcb on line 11 Warning: spl_object_hash() expects parameter 1 to be object, string given in /in/noTcb on line 11 bool(true)
Output for 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/noTcb on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/noTcb on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/noTcb on line 10 bool(true) bool(false) Warning: spl_object_hash() expects parameter 1 to be object, string given in /in/noTcb on line 11 Warning: spl_object_hash() expects parameter 1 to be object, string given in /in/noTcb on line 11 bool(true)
Output for 5.0.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/noTcb on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/noTcb on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/noTcb on line 10 Fatal error: Call to undefined function spl_object_hash() in /in/noTcb on line 7
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/noTcb on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/noTcb on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/noTcb on line 10 Fatal error: Cannot instantiate non-existent class: exception in /in/noTcb on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/noTcb on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/noTcb on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/noTcb on line 10 Fatal error: Cannot instantiate non-existent class: exception in /in/noTcb on line 4