How to assign an object function to a variable?
<pre><code>class example()
{
    function shout($var)
    {
        echo 'shout'.$var;
    }

    function whisper($var, $bool)
    {
        if($bool)
        {
           echo $var;
        }
    }
}

$obj = new example();

if($var) 
{
    $func = $obj-&gt;shout();
}else
{
    $func = $obj-&gt;whisper();
}
</code></pre>

<p>I want to prepare the function variable first for later use instead of putting conditions in a loop. Is there a possible way to do it?</p>
