Is it possible to have dynamic function calls in PHP? I don't know if I am calling it the right name, but my example hopefully will explain what I want.
<?
function image_filename(){
global $the_image;
return return $the_image->filename;
}
function image_anchor(){
global $the_image;
return getAnchor($the_image->id);
}
// is there a way to make a function that will do something like this:
// I know it's possible using a class and __call, but is it possible for a general case
function image_REQUEST(){
global $the_image;
$args = func_get_args();
switch(REQUEST){
case "filename":
return $the_image->filename;
break;
case "anchor":
return getAnchor($the_image->id);
break;
}
}
?>
Clarification:
I know about variable functions, and call_user_func
. These are not what I am looking for. Basically, I don't want to define image_filename
or image_anchor
, but have them defined when they are called.