CKTIS / PHP
is_null()
Test whether a supplied value is exactly null.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
is_null(mixed $value): boolTest whether a supplied value is exactly null. Zero and the empty string remain distinct. Accessing a missing array key directly can issue a warning, while a null-coalescing lookup avoids it and intentionally combines absence with a stored null.
Signature
is_null(mixed $value): bool
Example output
[true,false,false,true]
Examples
<?php
$data = ["key"=>null];
echo json_encode([is_null($data["key"]), is_null(0), is_null(""), is_null($data["absent"] ?? null)]);
Result
[true,false,false,true]