Last active
August 5, 2016 03:49
-
-
Save kjohnson/f173b1557796a10c4cb8dcac5a7ddfc6 to your computer and use it in GitHub Desktop.
Dynamic method call.
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 | |
| class Foo | |
| { | |
| function bar() | |
| { | |
| $baz = 'qux'; | |
| $this->{ $baz }( 'qux' ); | |
| } | |
| function qux( $qux ) | |
| { | |
| echo $qux; | |
| } | |
| } | |
| $foo = new Foo(); | |
| $foo->bar(); // Output: qux |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment