PHP dinamik işlev çağrıları olması mümkün mü? Ben bunu doğru isim arıyorum olmadığını bilmiyorum, ama benim örnek umarım istediğimi açıklayacağım.
<?
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;
}
}
?>
Açıklama:
Ben değişkenli fonksiyonlar hakkında bilmek ve call_user_func
. Bunlar benim aradığım değil. Temelde, ben image_filename
veya image_anchor
tanımlamak, ancak onlara denir zaman tanımlanmış olması istemiyorum.