What I'm doing now:
$length = strlen($string);
if( $length > 5 && $length < $10 )
In order to avoid double length measurement:
if( strlen($string) > 5 && strlen($string) < 10 )
Is there a nicer way of doing this? Something like:
if( 5 < strlen($string) < 10 )
There is no between operator in PHP. You could do something like:
The way you are doing is nice and clean, and probably a bit faster than the in_array+range.