3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Bar; class foo { function bar(){ echo \__CLASS__; } } (new foo)->bar();
Output for 8.1.23 - 8.1.28, 8.2.10 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught Error: Undefined constant "__CLASS__" in /in/NJNAn:8 Stack trace: #0 /in/NJNAn(13): Bar\foo->bar() #1 {main} thrown in /in/NJNAn on line 8
Process exited with code 255.
Output for 7.1.0 - 7.1.13, 7.2.0 - 7.2.1
Parse error: syntax error, unexpected '__CLASS__' (T_CLASS_C), expecting identifier (T_STRING) in /in/NJNAn on line 8
Process exited with code 255.

preferences:
55.45 ms | 402 KiB | 45 Q