Example 1 — Names of Basic Types
Print the debug type of the most common PHP values.
<?php
echo get_debug_type(42), PHP_EOL;
echo get_debug_type(3.14), PHP_EOL;
echo get_debug_type("hi"), PHP_EOL;
echo get_debug_type(true), PHP_EOL;
echo get_debug_type(null), PHP_EOL;
echo get_debug_type([1, 2]), PHP_EOL; How It Works
- An integer such as 42 returns int.
- A decimal number returns float, not double.
- Text returns string, and true or false returns bool.
- null returns the lowercase word null, and a list returns array.

