Created
June 2, 2012 08:32
-
-
Save iakio/2857336 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_ALL | E_STRICT); | |
class C | |
{ | |
public static $one = 1; | |
public $two = 2; | |
static function a() { echo "a\n"; } | |
function b() { echo "b\n"; } | |
} | |
$c = new C; | |
$c->a(); | |
$c->b(); | |
C::a(); | |
C::b(); // <-- PHP Strict standards: Non-static method C::b() should not be called statically | |
echo $c->one, "\n"; // <-- PHP Strict standards: Accessing static property C::$one as non static | |
echo $c->two, "\n"; | |
echo C::$one, "\n"; | |
echo C::$two, "\n"; // <-- PHP Fatal error: Access to undeclared static property: C::$two |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment