Answers for "php check if float has decimals"

PHP
1

check if number is float in php

//check if number is float
$float = is_float(2.4);
echo $float; //Returns true (1) if number is a float and false otherwise
Posted by: Guest on March-29-2021
0

php form detect if number has decimals

function is_decimal( $val )
{
    return is_numeric( $val ) && floor( $val ) != $val;
}
Posted by: Guest on November-05-2021

Code answers related to "php check if float has decimals"

Browse Popular Code Answers by Language