Created
May 19, 2016 18:51
-
-
Save DrewAPicture/bec0e76d5b4c618ee3c4184eea8db6af 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 | |
class Beer { | |
const NAME = 'Beer!'; | |
public static function printed(){ | |
echo 'static Beer:NAME = '. static::NAME . '<br />'; | |
} | |
} | |
class Ale extends Beer { | |
const NAME = 'Ale!'; | |
public static function printed(){ | |
forward_static_call(array('parent','printed')); | |
call_user_func(array('parent','printed')); | |
forward_static_call(array('Beer','printed')); | |
call_user_func(array('Beer','printed')); | |
} | |
} | |
Ale::printed(); | |
echo '</pre>'; | |
// Outputs: | |
// static Beer:NAME = Ale! | |
// static Beer:NAME = Ale! | |
// static Beer:NAME = Ale! | |
// static Beer:NAME = Beer! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment