PHP __call vs method_exists
Posted
by neo
on Stack Overflow
See other posts from Stack Overflow
or by neo
Published on 2009-10-01T18:37:43Z
Indexed on
2010/06/10
11:52 UTC
Read the original article
Hit count: 144
php
|overloading
The Project I'm working on contains something like a wrapper for call_user_func(_array) which does some checks before execution. One of those checks is method_exists (In Case the supplied first argument is an instance of a class and the second is a method name) The other is_callable. The function will throw an exception if one of those checks fails.
My Code contains an array with function names (setFoo, setBar, etc.) and the php magic function for overloading (__call) which handles setting, replacing and deletion of certain variables (better certain array elements).
The Problem: method_exists will return false if the function is not defined.
Do I have any chance to get a true if the __call function does proper handling of the request?
© Stack Overflow or respective owner