Example 1 — Floats and Non-Floats
Test a decimal number, an integer, a numeric string and scientific notation.
<?php
var_dump(is_float(3.14));
var_dump(is_float(3));
var_dump(is_float("3.14"));
var_dump(is_float(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.
- "3. 14" is in quotes, so it is a string.
- 1e3 is scientific notation, which PHP always treats as a float, even though its value is 1000.

