Is there a way to emulate PHP5's __call() magic method in PHP4?
问题 PHP5 has a "magic method" __call() that can be defined on any class that is invoked when an undefined method is called -- it is roughly equivalent to Ruby's method_missing or Perl's AUTOLOAD . Is it possible to do something like this in older versions of PHP? 回答1: The most important bit that I was missing was that __call exists in PHP4, but you must enable it on a per-class basis by calling overload() , as seen in php docs here . Unfortunately, the __call() function signatures are different