检查php中的内置函数

Lui*_*uis 2 php native function built-in

我想验证字符串值是否具有 php 中内置函数的名称。有什么方法可以知道吗?

我使用过 function_exists 函数,但我只在非内置函数中使用 call_user_func_array 。

谢谢

Fel*_*rte 5

您可以使用get_define_functions

<?php

$b = get_defined_functions();
in_array('something', $b['internal']); //FALSE
in_array('in_array', $b['internal']); //TRUE
Run Code Online (Sandbox Code Playgroud)

该函数function_exists对于内置函数和用户定义函数都将返回 true,使用此代码您只能使用内置函数进行检查;