I have a select box:
<select name="count">
<option value="0">Select count</option>
<option value="1">1</option>
<option value="2">2</option>
..
<option value="5">5</option>
<option value="5+">5+</option>
</select>
So I want to check if the value is an integer or 5+
.
I tried:
$pattern = '/^[0-9]*?[0-9+]$/';
$count = '1';
if(preg_match($pattern, $count)){
echo 'Valid';
}else{
echo 'Invalid';
}
That returns Valid
.
$count = '10+';
That also returns Valid
.
But not sure if that's working well or not.
Is it checking integer or integer+?
I want to check for an integer or 5+ only.