Is there a way to test a range without doing this redundant code:
if ($int>$min && $int<$max)
?
Like a function:
function testRange($int,$min,$max){
return ($min<$int && $int<$max);
}
usage:
…
I'm parsing some text and calculating the weight based on some rules. All the characters have the same weight. This would make the switch statement really long can I use ranges in the case statement.
I saw one of the …
I have an IP address and I'm given two other IP addresses which together creates an IP range. I want to check if the first IP address is within this range. How can i find that out in PHP?