Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Difficult to name this: Getting >= from a variable

    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?
    If I'm postin here, I NEED YOUR HELP!!

  • #2
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    I don't know if it would work as I've never tried it before but try this...

    PHP Code:
    if(eval($var1." ".$eq." ".$var2)){ 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •