3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $instance = new class {}; $class_name = get_class($instance); $new_instance = new $class_name; class_alias($class_name, 'MyAlias'); var_dump($instance, $class_name, $new_instance, new MyAlias); // $x = "class@anonymous".chr(0).'/foo'; new $x; $d = get_declared_classes(); end($d); var_dump(current($d));
based on RosBE
Output for 7.2.0
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7fabbfe3a01e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 7.1.10
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7fbabd22a01e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 7.1.7
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7f110a9ce01e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 7.1.6
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7f995d34101e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 7.1.5
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7f8e90c5c01e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 7.1.0
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7fdd0006b01e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 7.0.20
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7f5a0793d01e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 7.0.6
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7ffb1545a01e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 7.0.5
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7f390032c01e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 7.0.4
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7f1fd915a01e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 7.0.3
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7f3ddae9c01e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 7.0.2
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7fa63d64c01e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 7.0.1
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7f509badb01e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 7.0.0
object(class@anonymous)#1 (0) { } string(39) "class@anonymous/in/i7Xul0x7f2b86bab01e" object(class@anonymous)#2 (0) { } object(class@anonymous)#3 (0) { } Fatal error: Uncaught Error: Class 'class@anonymous' not found in /in/i7Xul:13 Stack trace: #0 {main} thrown in /in/i7Xul on line 13
Process exited with code 255.
Output for 5.4.9 - 5.6.28
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/i7Xul on line 3
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_CLASS in /in/i7Xul on line 3
Process exited with code 255.