Saturday 13 April 2013

php call method froma string with parameters

very simple way to do that 


function abcd($parameter)
{
     return ture ;
}

$meth_str="abcd('ab')";
$res = false;
        $abc = '$res';
        $check = <<<bcd
if($meth_str)
{
        $abc= true;
} else
{
        $abc=false;
}
bcd;

        eval($check.";");    ///   that means $res=true;
     

Hope it helps
if need further help  comment here 


No comments:

Post a Comment