3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C{ public const SOME_CONST="SOME_CONST_VAL"; public $some_not_const = "some_not_const"; function f(){ /*legal*/ return "blah blah {$this->some_not_const} blah blah"; /*illegal*/ return "blah blah {$this::SOME_CONST} blah blah"; } }
Output for 8.0.0 - 8.0.13, 8.1rc1 - rc3
Parse error: syntax error, unexpected token "}", expecting "->" or "?->" or "{" or "[" in /in/W8Z7M on line 8
Process exited with code 255.
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.26
Parse error: syntax error, unexpected '}', expecting '[' in /in/W8Z7M on line 8
Process exited with code 255.

preferences:
20.97 ms | 457 KiB | 5 Q