3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { } $a [ new A ]; $b = [clone $a[0]]; $c = clone $a; var_dump($a[0] === $b[0]); var_dump($a[0] === $c[0]);
Output for 7.0.0 - 7.2.0
Notice: Undefined variable: a in /in/CcfUr on line 7 Notice: Undefined variable: a in /in/CcfUr on line 10 Fatal error: Uncaught Error: __clone method called on non-object in /in/CcfUr:10 Stack trace: #0 {main} thrown in /in/CcfUr on line 10
Process exited with code 255.
Output for 5.4.2 - 5.6.28
Notice: Undefined variable: a in /in/CcfUr on line 8 Notice: Undefined variable: a in /in/CcfUr on line 10 Fatal error: __clone method called on non-object in /in/CcfUr on line 10
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/CcfUr on line 10
Process exited with code 255.