tags:

views:

95

answers:

2

Hi, I am trying to develop an application that intercepts functions. I know in class methods, you can have a __call() method for functions. I am wondering if such a thing exists for regular functions? I know there is a "function_exists" call, but then I'd have to do that everytime I call a function. I'd like an automated approach.

Any help is appreciated. Thanks.

A: 

Object Overloading is only available for classes. Also "function_exists" is very slow.

BTW there is also is_callable

Ólafur Waage
+1  A: 

There's no equivalent functionality. Depending on your actual situation, you may be able to get some mileage out of __autoload(), which is the only magic function that's defined in global scope rather than for a class; it allows you to demand-define classes.

chaos