<?php
error_reporting(-1);
class A {
static $i=1;
public function test(){
echo self::$i;
}
}
class B extends A {
static $i=2;
public function test(){
echo self::$i;
}
}
B::test();
Fatal error: Uncaught Error: Non-static method B::test() cannot be called statically in /in/OSB53:15
Stack trace:
#0 {main}
thrown in /in/OSB53 on line 15
Process exited with code 255.
Strict Standards: Non-static method B::test() should not be called statically in /in/OSB53 on line 15
2
Output for 5.0.0 - 5.0.3
Fatal error: Cannot redeclare property static public A::$i in class B in /in/OSB53 on line 14
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/OSB53 on line 4
Process exited with code 255.
Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/OSB53 on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/OSB53 on line 4
Process exited with code 255.