我想验证字符串值是否具有 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
对于内置函数和用户定义函数都将返回 true,使用此代码您只能使用内置函数进行检查;
关于php - 检查php中的内置函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62954378/