0
我所需要的所有定义的函数在函数名的特定字符串列表开始PHP列表包含与特定字符串
例子: 我想所有的功能在我的文件中有"special_pdf"
串之类的函数名 -
special_pdf_a4()
special_pdf_a5()
special_pdf_16()
special_pdf_97()
special_pdf_same_same_example()
目前正在使用此代码 -
$commandList = get_defined_functions();
$funcList = array();
$containText = 'special_pdf';
if(isset($commandList['user'])){
$user_defined_functions = $commandList['user'];
foreach($user_defined_functions as $user_defined_function){
if(substr($user_defined_function, 0, strlen($containText)) === $containText){
$funcList[] = $user_defined_function;
}
}
}
print_r($funcList);
是一个正确的方式来连接没有性能缺陷?