Created
June 27, 2012 13:19
-
-
Save CrBoy/3004013 to your computer and use it in GitHub Desktop.
PHP magic function __call example
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 MyClass | |
{ | |
public function __construct() | |
{ | |
} | |
public function __call($name, $args) | |
{ | |
echo "You called method \"$name\", and the args is:\n"; | |
var_dump($args); | |
} | |
} | |
$c = new MyClass(); | |
$c->a(); | |
$c->f('a', 'b', 'c'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment