View Full Version : Difficult to name this: Getting >= from a variable

07-02-2005, 06:14 AM
I need to be able to send part of an equation into a function. In other words, i wanted a variable in the function that is "==" or ">=" or "<=". Thats fine, but is there a way I can put this in my equation without all those if statments?

$eq = ">=";
if( $var1 $eq $var2){
would become:
if( $var1 >= $var2){

Any way to do this?

SeeIT Solutions
07-02-2005, 07:51 AM
I don't know if it would work as I've never tried it before but try this...

if(eval($var1." ".$eq." ".$var2)){