Re: [PHP-DB] variable if statement

2001-08-23 Thread Andrey Hristov
IcyGEN Corporation http://www.icygen.com 99% - Original Message - From: "Rick Emery" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 23, 2001 8:27 PM Subject: RE: [PHP-DB] variable if statement > eval will work, but the entire thing must be

RE: [PHP-DB] variable if statement

2001-08-23 Thread Rick Emery
eval will work, but the entire thing must be in the eval(). It would look like: $flag = 0; $test = "(a==1) OR (b==1)"; $string = "if($test){ $flag =1;}"; eval($string); if( $flag ==1 ) {do_something;} I had to resort to this in a similar situation. I read the condition and result action in a M

Re: [PHP-DB] variable if statement

2001-08-23 Thread Andrey Hristov
$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

Re: [PHP-DB] variable if statement

2001-08-23 Thread Jason Wong
- Original Message - From: Brian Weisenthal <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 24, 2001 1:14 AM Subject: [PHP-DB] variable if statement > i want to do something like this: > > $string="($a==1) OR ($b==2)"; > > if ($string) { do something ; } > > any idea