判定數字的大小是否在某個范圍內,假如僅僅是判定是否為數字無需使用。
# 判定數字大小,無大小的判定可以用系統帶的 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;
}
}