Last active
August 27, 2015 15:05
-
-
Save mickaelandrieu/e33275946e25d185c562 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 | |
// sources: http://stackoverflow.com/a/4719222 | |
class A { | |
public static function className(){ | |
echo __CLASS__; | |
} | |
public static function test(){ | |
self::className(); | |
} | |
} | |
class B extends A{ | |
public static function className(){ | |
echo __CLASS__; | |
} | |
} | |
B::test(); //A | |
class A { | |
public static function className(){ | |
echo __CLASS__; | |
} | |
public static function test(){ | |
static::className(); | |
} | |
} | |
class B extends A{ | |
public static function className(){ | |
echo __CLASS__; | |
} | |
} | |
B::test(); // B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment