简体   繁体   中英

Check built-in function in php

I want to verify if a string value has the name of a built-in function in php. There is some way of know it?

I've used function_exists function but I only to use call_user_func_array in non buit-in functions.

Thanks

You can use get_defined_functions

<?php

$b = get_defined_functions();
in_array('something', $b['internal']); //FALSE
in_array('in_array', $b['internal']); //TRUE

The function function_exists will return true for both built-in and user-defined, with this code you can check only with built-in functions;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM