Php – How to determine whether a variable is a decimal and it is less than 0.01 in PHP

algorithmbooleandecimalPHP

How to determine whether a variable is a decimal and it is less than 0.01 in PHP?
If I write

if($balance<0.01)

Will a

true

value be returned if

$balance

is not a decimal at all?

Best Answer

use if( is_numeric($balance) && $balance < 0.01 )

http://php.net/manual/de/function.is-numeric.php