Example 1 — Checking Whole Numbers
Pass positive, negative and zero values and see that all of them are integers.
<?php
var_dump(is_long(42));
var_dump(is_long(-7));
var_dump(is_long(0)); How It Works
- 42 is a whole number. PHP stores it as an int, so the result is true.
- -7 is a negative integer. The sign does not change the type, so it is also true.
- 0 is an integer too. Zero is a normal whole number, so the result is true.
- var_dump() shows the result as a real boolean. This makes it easy to see true and false.

