Created
September 14, 2012 18:11
-
-
Save markkelnar/3723638 to your computer and use it in GitHub Desktop.
PHP variable variables
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 | |
# Reference http://us.php.net/language.variables.variable | |
class foo { static function hello() { print __LINE__." ".get_class()." world\n"; } } | |
class bar { function hello() { print __LINE__." ".get_class()." world\n"; } } | |
function hello() { print __LINE__." world\n"; } | |
call_user_func('hello'); | |
call_user_func( array('foo','hello') ); | |
$z = new bar(); | |
call_user_func( array($z,'hello') ); | |
$a = 'hello'; | |
call_user_func($a); | |
$hello = 'world'; | |
print __LINE__." ".$$a."\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment