Php filter problem

SpaceshipSpaceship
Watch

Dean

VIP Member
Impact
91
I could swear this was working before but all of a sudden it isnt.

PHP:
$int_options = array(
        "options"=>array
        (
        "min_range"=>-1000000000,
        "max_range"=>1000000000
        )
      );

PHP:
elseif(!filter_var($_GET["min"], FILTER_VALIDATE_INT, $int_options))
        {
        echo("Range is between -1000000000 and 1000000000");
        }
      elseif(!filter_var($_GET["max"], FILTER_VALIDATE_INT, $int_options))
        {
        echo("Range is between -1000000000 and 1000000000");
        }

The problem is that it thinks 0 is either not a valid integer or not in the range -1000000000 and 1000000000 because it enters the elseif statements. Any ideas? If you need more of the code just tell me.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Not going to be able to help much without seeing all the relevant code.

However the most likely cause is the fact 0 is boolean for false.
 
0
•••
Exactly what I was thinking as I had a similar problem with checking for a valid boolean input but I sorted that out. What troubles me with this is that I am 99% sure the code was working before.

Will have a look later and see what other code might be relevant and post it but I think thats the main bit since it returns "Range is between -1000000000 and 1000000000" when either min or max is 0.
 
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back