<?php
class Foo{
public $name = 'petr';
public function myName(){
return $this->name;
}
}
class FooFoo{
public $name = 'PAVEL';
public function myName(){
return Foo::myName();
}
}
$c = new FooFoo();
echo $c->myName();// PAVEL
Fatal error: Uncaught Error: Non-static method Foo::myName() cannot be called statically in /in/iUkF2:17
Stack trace:
#0 /in/iUkF2(22): FooFoo->myName()
#1 {main}
thrown in /in/iUkF2 on line 17
Process exited with code 255.
Deprecated: Non-static method Foo::myName() should not be called statically in /in/iUkF2 on line 17
Fatal error: Uncaught Error: Using $this when not in object context in /in/iUkF2:7
Stack trace:
#0 /in/iUkF2(17): Foo::myName()
#1 /in/iUkF2(22): FooFoo->myName()
#2 {main}
thrown in /in/iUkF2 on line 7
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught Error: Using $this when not in object context in /in/iUkF2:7
Stack trace:
#0 /in/iUkF2(17): Foo::myName()
#1 /in/iUkF2(22): FooFoo->myName()
#2 {main}
thrown in /in/iUkF2 on line 7
Process exited with code 255.
Output for 5.6.0 - 5.6.28
Deprecated: Non-static method Foo::myName() should not be called statically, assuming $this from incompatible context in /in/iUkF2 on line 17
PAVEL
Strict Standards: Non-static method Foo::myName() should not be called statically, assuming $this from incompatible context in /in/iUkF2 on line 17
PAVEL
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.1.2
PAVEL
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/iUkF2 on line 22
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/iUkF2 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/iUkF2 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/iUkF2 on line 4
Process exited with code 255.