__call( ) method is called if PHP fails to find the method : __call « Class « PHP






__call( ) method is called if PHP fails to find the method

 
<?
    class Dog {
            public $Name;
            public function bark( ) {
                    print "Woof!\n";
            }

            public function __call($function, $args) {
                    $args = implode(', ', $args);
                    print "Call to $function( ) with args '$args' failed!\n";
            }
    }

    $poppy = new Dog;
    $poppy->meow("foo", "bar", "baz");
?>
  
  








Related examples in the same category

1.Intercepting Method Calls with the __call() Method (PHP 5 Only)
2.Using the __call() Method