Reputation: 5039
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
Upvotes: 0
Views: 220
Reputation: 5039
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.
Upvotes: 0