bad practice? what's it 'called'
<p>in PHP, I'm considering doing something like this:</p>

<pre><code>function foo(){
echo 'bar';
}

$fn = 'foo';

$fn();
</code></pre>

<p>It works, but is it considered bad practice?</p>

<p>I have an multidimensional array of elements that each have a corresponding function. I would like to store that function name, and call the corresponding functions for each element when traversing the array.</p>

<p>something like:</p>

<pre><code>function render_el1(){ echo 'et';}
function render_el2(){ echo 'to';}

$elements = array(
    'el_1' =&gt; array(
        'name' =&gt; 'Element One'
    ,   'func' =&gt; 'render_el1'
    )
,   'el_2' =&gt; array(
        'name' =&gt; 'Element Two'
    ,   'func' =&gt; 'render_el2'
    )
);


foreach($elements as $element =&gt; $options){
    $fn = $options['func'];

    echo '&lt;h1&gt;'.$options['name'].'&lt;/h1&gt;';

    if (function_exists($fn)) {
        $fn();
    }
}
</code></pre>

<p>Any comments to this approach is highly welcome, and I'd also like to know what this method is called in programming terms.</p>
