3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A {} $obj = new A; class_alias($obj, 'B'); $b = new B;
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught TypeError: class_alias(): Argument #1 ($class) must be of type string, A given in /in/6b0X9:6 Stack trace: #0 /in/6b0X9(6): class_alias(Object(A), 'B') #1 {main} thrown in /in/6b0X9 on line 6
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Warning: class_alias() expects parameter 1 to be string, object given in /in/6b0X9 on line 6 Fatal error: Uncaught Error: Class 'B' not found in /in/6b0X9:8 Stack trace: #0 {main} thrown in /in/6b0X9 on line 8
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Warning: class_alias() expects parameter 1 to be string, object given in /in/6b0X9 on line 6 Fatal error: Class 'B' not found in /in/6b0X9 on line 8
Process exited with code 255.

preferences:
152.52 ms | 402 KiB | 183 Q