Skip to content

Instantly share code, notes, and snippets.

@s-shin
Created January 9, 2015 10:40
Show Gist options
  • Select an option

  • Save s-shin/68011eec88f83df2550a to your computer and use it in GitHub Desktop.

Select an option

Save s-shin/68011eec88f83df2550a to your computer and use it in GitHub Desktop.
<?php
class Foo
{
public $bar;
function __construct()
{
$this->bar = 'bar';
}
public function echoFoo()
{
echo 'foo';
}
public function echoBar()
{
Bar::echoBar();
}
}
class Bar
{
public function echoBar()
{
echo $this->bar;
}
}
$foo = new Foo();
$foo->echoFoo();
$foo->echoBar();
echo "\n";
@s-shin
Copy link
Author

s-shin commented Jan 9, 2015

From PHP 5.4, if the error level is E_STRICT, "Strict Standards" warning occurs.

fooPHP Strict Standards:  Non-static method Bar::echoBar() should not be called statically, assuming $this from incompatible context in ... on line 19

Strict Standards: Non-static method Bar::echoBar() should not be called statically, assuming $this from incompatible context in ... on line 19
bar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment