My name is Edward Tanguay. I'm an American software and web developer living and working in Berlin, Germany.
PHP CODE EXAMPLE created on Sunday, November 28, 2010 permalink
How to call an unknown function on an unknown class with unknown parameters
The call_user_func_array function can help you build some pretty flexible framework code in PHP, here's the syntax to call a function on an existing object.
<?php

$pm = new PresentationManager();
echo $pm->displayTest('the title', 'the footer', 5);


$params = array( 'the title2', 'the footer2', 10);
echo call_user_func_array(array($pm, 'displayTest'), $params);


class PresentationManager {

    function displayTest($title, $footer, $numberOfItems = 0) {
        $r = '';
        $r .= '<div>'.$title.'</div>';
        for($index = 0; $index < $numberOfItems; $index++) {
            $r .= '<div>the text</div>';
        }
        $r .= '<div>'.$footer.'</div>';
        return $r;
    }
}
?>
need markup?