How to list the functions in a PHP file

When debugging your PHP code you often run into an issue where you’re trying to find the scope of what variables are available. Whether you’re taking over a project from someone, or you’re using a CMS or framework, being able to list in an array all the functions comes handy.

Here’s the simple PHP function to get all the functions available to you:

This will output something like:

That gives you the internal, php core functions, and user defined functions (the ones you or your CMS defines). Let’s take this a step further and make a function that gets only the user defined functions.

You can rename get_functions() to whatever you want it to be. I usually prefix my functions based on the specific CMS or framework I’m using.


You’ve just learned something pretty basic, but handy. Use with care.


Leave a comment

Find the Best SEO in Fort Lauderdale, Florida (Plantation SEO) | Drupal & Worpress Develpment