Luis
Luis

Reputation: 383

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

Upvotes: 2

Views: 792

Answers (1)

Felippe Duarte
Felippe Duarte

Reputation: 15131

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;

Upvotes: 5

Related Questions