Example 1 — Floats and Non-Floats
Test a decimal number, an integer, a numeric string and a number written in scientific notation.
<?php
var_dump(is_double(3.14));
var_dump(is_double(3));
var_dump(is_double("3.14"));
var_dump(is_double(1e3)); How It Works
- 3. 14 has a decimal point, so it is a float.
- 3 is a whole number, so it is an integer and the result is false.
- A number in quotes is a string, so the result is false.
- 1e3 is scientific notation. PHP always treats it as a float, even though its value is 1000.

