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
It is spelled min_range
not min-range
.
For those wondering how I fixed the negative number issue also: I did the following:
$options = array(
'options' => array(
'min_range' => 1
)
);
filter_var($jobPostings['remainingTokens'], FILTER_VALIDATE_INT, $options)
Hopefully that is of some use to someone.