Created
February 7, 2014 00:53
-
-
Save andyfriesen/8855570 to your computer and use it in GitHub Desktop.
PHP, __call and access protection.
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 B { | |
public function __call($fn, $args) { | |
$c = array($this, 'hello'); | |
$c(); | |
} | |
private function hello() { | |
echo "hello B\n"; | |
} | |
private function goodbye() { | |
echo "goodbye B\n"; | |
} | |
} | |
$b = new B; | |
$b->hello(); | |
$fn = array($b, 'goodbye'); | |
$fn(); |
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
hello B | |
hello B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment