tags:

views:

46

answers:

2

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());
+1  A: 

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.

See get_defined_functions().

Note: functions defined by create_function() are not returned.

cletus
+1  A: 

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.

gclaghorn