3v4l.org

run code in 300+ PHP versions simultaneously
<?php class par { protected static $a = "AA"; function echoA() { echo self::$a; } } class enf extends par { __construct() { self::$a . ' BB'; parent::$a . ' CC'; } } class arenf extends par { function echoA() { echo self::$a; } } $enf = new enf(); $arenf = new arenf(); $arenf->echoA();
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected '__construct' (T_STRING), expecting function (T_FUNCTION) in /in/82EL9 on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /in/82EL9 on line 10
Process exited with code 255.

preferences:
181.15 ms | 1399 KiB | 53 Q