Generating an array of functions?
- by Wordpressor
I have a few PHP files filled with multiple functions. Let's call them functions1.php, functions2.php, functions3.php:
function function_something( $atts ) {
extract( something_atts( array(
'foo' => 'bar',
'bar' => 'foo,
), $atts ) );
return 'something';
}
I'm loading these files within all_functions.php like this:
require_once('functions1.php');
require_once('functions2.php');
require_once('functions3.php');
I'm wondering if it's possible to create an array of all these functions and their attributes?
I'm thinking about something like:
function my_functions() {
require_once('functions1.php');
require_once('functions2.php');
require_once('functions3.php');
}
And then some foreach loop, but I'm not sure how should it look like after all.
I know this probably looks tricky, but I'm just curious if I'm able to list all my WordPress shortcodes without PHP's Reflection API :)