Skip to content

Instantly share code, notes, and snippets.

@mickaelandrieu
Last active August 27, 2015 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mickaelandrieu/e33275946e25d185c562 to your computer and use it in GitHub Desktop.
Save mickaelandrieu/e33275946e25d185c562 to your computer and use it in GitHub Desktop.
<?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