Created
March 10, 2010 12:12
-
-
Save troelskn/327807 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 | |
class Foo { | |
protected static $blah; | |
static function stuff() { | |
static $cuux = null; | |
if ($cuux === null) { | |
echo "It's null.\n"; | |
$cuux = 42; | |
} else { | |
echo "It's not null anymore.\n"; | |
} | |
} | |
static function stiff() { | |
if (self::$blah === null) { | |
echo "It's null.\n"; | |
self::$blah = 42; | |
} else { | |
echo "It's not null anymore.\n"; | |
} | |
} | |
} | |
class Bar extends Foo { | |
} | |
Foo::stuff(); // It's null. | |
Foo::stuff(); // It's not null anymore. | |
Bar::stuff(); // It's null. | |
Bar::stuff(); // It's not null anymore. | |
echo "---\n"; | |
Foo::stiff(); // It's null. | |
Foo::stiff(); // It's not null anymore. | |
Bar::stiff(); // It's not null anymore. | |
Bar::stiff(); // It's not null anymore. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment