Generating an array of functions?

Posted by Wordpressor on Stack Overflow See other posts from Stack Overflow or by Wordpressor
Published on 2012-03-22T17:19:17Z Indexed on 2012/03/22 17:30 UTC
Read the original article Hit count: 241

Filed under:
|
|
|

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 :)

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays