3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { const OMG = 10; public static WTF = 12; public function get($what) { return constant("self::" . $what); } } class Test2 { private $test; public function __construct(Test $test) { $this->test = $test; } public function testFunc() { var_dump($this->test::WTF); var_dump($this->test->get("OMG")); } } $test = new Test(); $test2 = new Test2($test); var_dump($test2->testFunc());
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected 'WTF' (T_STRING), expecting variable (T_VARIABLE) in /in/Sksda on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/Sksda on line 5
Process exited with code 255.

preferences:
174.43 ms | 1395 KiB | 67 Q