Re: variable if statement

From: Date: Thu, 23 Aug 2001 17:24:12 +0000
Subject: Re: variable if statement
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-11735@lists.php.net to get a copy of this message
$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" <bsw10@cornell.edu> To: <php-db@lists.php.net> 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: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.db (#11735) next »