Last active
December 17, 2015 06:19
-
-
Save cnorthwood/5564150 to your computer and use it in GitHub Desktop.
why does this not work?
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 Base { | |
public static $value; | |
public static function get() { | |
return static::$value; | |
} | |
} | |
class Child extends Base { | |
public static $value = 'hello'; | |
} | |
var_dump(Child::get() == 'hello'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use static:: instead of self:: - see http://www.php.net/manual/en/language.oop5.late-static-bindings.php