CKTIS / PHP
gettype()
Read the historical type label used by PHP for diagnostics.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
gettype(mixed $value): stringRead the historical type label used by PHP for diagnostics. Floating-point values have the label "double", null has "NULL" and every object has "object" regardless of class. Use the specific predicate for a programmatic type check.
Signature
gettype(mixed $value): string
Example output
["integer","double","NULL","object"]
Examples
<?php
echo json_encode(array_map("gettype", [1, 1.5, null, new stdClass()]));
Result
["integer","double","NULL","object"]