How to use is_callable with __call? How to use is_callable with __call? php php

How to use is_callable with __call?


First idea: how about checking if method exists in get_class_methods()? This function takes care of scope issues.

Second idea: if function you're looking for doesn't exist in a class, you could also check (using method_exists) if class contains __call magic method, if it doesn't than obviously call to a non-existing function is illegal. If class contains __call method, it's likely that caller knows what he's doing.

These are just my thoughts, I assume Python to be better in this kind of things.