2012-08-13 18 views

回答

2
$funcs = get_defined_functions(); 

foreach($funcs['user'] as $f) { 
    if(strstr($f, 'Test')) 
     call_user_func($f); 
} 
-1

您應該使用Get All methods PHP函數來得到像下面

function helloTest() 
{ 
    echo 'hello'; 
} 

function worldTest() 
{ 
    echo 'world'; 
} 

function helloworld() 
{ 
    // call all functions with 'Test' 
    $methods = get_defined_functions(); 
    $user_defined_methods = $methods['user']; 
    foreach ($user_defined_methods as $method_name) 
    { 
     //check with regular expressions if it's having 'Test' at end of $method_name then call that function using call_user_func($method_name) 
    } 
} 

所有方法以獲得更多信息檢查this link

相關問題