判定数字的大小是否在某个范围内,假如仅仅是判定是否为数字无需使用。
# 判定数字大小,无大小的判定可以用系统带的 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;
}
}