Between operator in PHP

Submitted by Anonymous (not verified) on Mon, 06/29/2009 - 18:16

Is there a between operator for php to compare a value with two values(maximum-mimimum) same time?

For example:

if( 1 <= $day => 31 ) ...
if( $day between 1 and 31 )...

I can write a function but I want to find the shortest way without manually functions.

function between($val, $min, $max){
   if($val >= $min && $val <= $max) return true;
   return false;
}

if(between($day, 1, 31)) ...