Home > Backend Development > PHP Tutorial > Determine the size of a number_PHP tutorial

Determine the size of a number_PHP tutorial

WBOY
Release: 2016-07-20 11:00:12
Original
2098 people have browsed it

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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template