Skip to content

Instantly share code, notes, and snippets.

@darrennolan
Created June 1, 2014 08:20
Show Gist options
  • Save darrennolan/d7421a35f40da16689bf to your computer and use it in GitHub Desktop.
Save darrennolan/d7421a35f40da16689bf to your computer and use it in GitHub Desktop.
<?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