检查 php 中的内置函数
Check built-in function in php
我想验证字符串值是否具有 php 中内置函数的名称。有什么方法可以知道吗?
我用过 function_exists 函数,但我只在非内置函数中使用 call_user_func_array。
谢谢
<?php
$b = get_defined_functions();
in_array('something', $b['internal']); //FALSE
in_array('in_array', $b['internal']); //TRUE
函数 function_exists
对内置函数和用户定义函数都 return 为真,使用此代码您只能检查内置函数;
我想验证字符串值是否具有 php 中内置函数的名称。有什么方法可以知道吗?
我用过 function_exists 函数,但我只在非内置函数中使用 call_user_func_array。
谢谢
<?php
$b = get_defined_functions();
in_array('something', $b['internal']); //FALSE
in_array('in_array', $b['internal']); //TRUE
函数 function_exists
对内置函数和用户定义函数都 return 为真,使用此代码您只能检查内置函数;