Created
June 1, 2014 08:20
-
-
Save darrennolan/d7421a35f40da16689bf to your computer and use it in GitHub Desktop.
This file contains hidden or 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 A | |
{ | |
public static $name = 'a'; | |
public static function getSelfName() | |
{ | |
return self::$name; | |
} | |
public static function getStaticName() | |
{ | |
return static::$name; | |
} | |
} | |
class B extends A | |
{ | |
public static $name = 'b'; | |
} | |
var_dump ( A::getSelfName() ); // 'a' | |
var_dump ( A::getStaticName() ); // 'a' | |
var_dump ( B::getSelfName() ); // 'a' | |
var_dump ( B::getStaticName() ); // 'b' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment