Re: how to trap eval error?
| From: | CPT John W. Holmes | Date: | Tue, 18 Nov 2003 21:41:03 +0000 |
| Subject: | Re: how to trap eval error? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170176@lists.php.net to get a copy of this message | ||
From: "david" <dzhuo@looksmart.net>
> i found a solution (hopefully) with:
>
> if(function_exists($function)){
> eval('$return = $function($input);');
> }else{
> // function does not exists
> }
>
> which works quit nicely for now. not sure if that's a good thing to do.
Why not just do this:
if(function_exists($function))
{ $return = $function($input); }
else
{ //function does not exist; }
---John Holmes...