Home  >  Article  >  Backend Development  >  Determine the size of a number_PHP tutorial

Determine the size of a number_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:00:122047browse

Determine whether the size of the number is within a certain range. If you only determine whether it is a number, there is no need to use it.

# Determine the size of the number. To determine the size of the number, you can use the is_numeric($str)
provided by the system. #------------------------------------------------ ----------
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;
}
}


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445546.htmlTechArticleDetermine whether the size of the number is within a certain range. If it is just to determine whether it is a number, there is no need to use it. # Determine the size of the number. To determine the size of the number, you can use the is_numeric($str) provided by the system...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn