$func_body = "return ($a==1 or $b==2)";
$newfunc = create_function('$a,$b',$func_body);
if ($newfunc($first_par,$second_par)){
....
}
or
if ($newfunc($a,$b,"return (\$a==1 or \$b==2);")){
....
}
or
if ($newfunc($a,$b,'return (\$a==1 or \$b==2);')){
....
}
Hope this will help.
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
99%
----- Original Message -----
From: "Brian Weisenthal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 23, 2001 8:14 PM
Subject: [PHP-DB] variable if statement
> i want to do something like this:
>
> $string="($a==1) OR ($b==2)";
>
> if ($string) { do something ; }
>
> any ideas? i tried using if (eval($string)) but that just gave me errors.
>
> thanks
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]