How to check if a double variable contains an integer and not a floating point in PHP

1 Answer

0 votes
$d = 24278.0;

if ($d == floor($d)) {
    echo "The double variable contains an integer","\n";
}
else {
    echo "The double variable contains a floating point","\n";
}



/*
run:
  
The double variable contains an integer
  
*/

 



answered Mar 5, 2024 by avibootz
...