Reputation: 48973
I just discovered the get_defined_functions() function in PHP, I was checking it out, it list all the functions.
It in addition to php's built in functions, it list 176 function I have made for my site.
I have a question about it, are all the listed functions from this being loaded, like taking up resources or is it just showing they are available if I need them?
If it just shows all functions available, is there a way to list all that are being used?
print_r(get_defined_functions());
Upvotes: 1
Views: 1058
Reputation: 26545
From the PHP docs:
Returns an multidimensional array containing a list of all defined functions, both built-in (internal) and user-defined. The internal functions will be accessible via $arr["internal"], and the user defined ones using $arr["user"] (see example below).
CliffNotes version: it gives ALL available functions in a multi-dimensional array, regardless of whether or not they've been used.
As to the second part of your question, I am unaware of any built-in PHP function that will return all used functions.
Upvotes: 2
Reputation: 625307
Defined functions from scripts that are loaded for the current request, meaning if you haven't included (or required) a particular file then obviously it's functions won't be defined.
Note: functions defined by create_function()
are not returned.
Upvotes: 1