3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected final const BLOP = 1; public function get() { return static::BLOP; } public function get2() { return self::BLOP; } } class B extends A { protected const BLOP = 2; } $o = new B(); var_dump($o->get(), $o->get2());
Output for 5.5.0 - 5.5.36, 5.6.0 - 5.6.22, 7.0.0 - 7.0.7
Parse error: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in /in/dt9oc on line 5
Process exited with code 255.

preferences:
187.88 ms | 1395 KiB | 74 Q