Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

Php filter problem

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
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.
GoDaddyGoDaddy
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
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

Parking: find your domains by pasting a list
You can now paste a list of domain names into the search box at the top of the Parking menu. Put one name on each line. Your domain list...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back