判断数字的大小是否在某个范围内,如果仅仅是判断是否为数字无需使用。 ~~~ #---------------------------------------------------------- # 判断数字大小,无大小的判断可以用系统带的 is_numeric($str) #---------------------------------------------------------- Function isNumber ($fNum, $fMin="", $fMax="") { if ( eregi("^[0-9]+$", $fNum) ) { if ( "" == $fMax && "" == $fMin ) { Return True; } elseif ( "" == $fMin && $fNum <= $fMax ) { Return True; } elseif ( "" == $fMax && $fNum >= $fMin ) { Return True; } elseif ( $fNum >= $fMin && $fNum <= $fMax ) { Return True; } else { Return False; } } else { Return False; } } ~~~