Search code examples
phpfilter-var

FILTER_VALIDATE_INT unexpected result


I'm using the following code:

if(!filter_var($Postings['remainingTokens'], FILTER_VALIDATE_INT, array('min-range' => 1))){

$this->redirect(array('upgrade', 'id'=>$id));
}

When I have $Postings['remaingTokens'] equal to 1 or higher it works fine and doesn't execute within the if statement. If I have a negative value though it still doesn't execute the redirect(). Why is this the case? Apologies if this is simple?

Jonny


Solution

  • It is spelled min_range not min-range.