<?php
class T {
public function x(){
return true;
}
public function y(){
return self::x();
}
}
var_dump(T::x());
class X {
public function x(){
return true;
}
public function y(){
return self::x();
}
}
var_dump(X::x());
Fatal error: Uncaught Error: Non-static method T::x() cannot be called statically in /in/l5v8p:12
Stack trace:
#0 {main}
thrown in /in/l5v8p on line 12
Process exited with code 255.
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; X has a deprecated constructor in /in/l5v8p on line 14
Deprecated: Non-static method T::x() should not be called statically in /in/l5v8p on line 12
bool(true)
Fatal error: Uncaught Error: Non-static method X::x() cannot be called statically in /in/l5v8p:24
Stack trace:
#0 {main}
thrown in /in/l5v8p on line 24
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.26
bool(true)
Fatal error: Uncaught Error: Non-static method X::x() cannot be called statically in /in/l5v8p:24
Stack trace:
#0 {main}
thrown in /in/l5v8p on line 24
Process exited with code 255.
Strict Standards: Non-static method T::x() should not be called statically in /in/l5v8p on line 12
bool(true)
Fatal error: Non-static method X::x() cannot be called statically in /in/l5v8p on line 24
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/l5v8p on line 4
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/l5v8p 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/l5v8p on line 4
Process exited with code 255.