note 130435 added to function.empty

From: Date: Tue, 29 Jul 2025 09:45:05 +0000
Subject: note 130435 added to function.empty
Groups: php.notes 
Request: Send a blank email to php-notes+get-222293@lists.php.net to get a copy of this message
// 1) Define your cases with descriptive keys $testCases = [ 'empty_string_single' => '', 'empty_string_double' => "", 'null_value' => null, 'empty_array' => [], 'false_bool' => false, 'uppercase_NULL' => NULL, 'string_zero' => '0', 'int_zero' => 0, ]; // 2) Start HTML table echo '<table border="1" cellpadding="4" cellspacing="0">'; echo '<tr> <th>Case</th> <th>Raw Value</th> <th>Type</th> <th>empty()?</th> </tr>'; // 3) Iterate and report foreach ($testCases as $label => $value) { $raw = var_export($value, true); $type = gettype($value); $result = empty($value) ? 'true' : 'false'; echo "<tr> <td>{$label}</td> <td><code>{$raw}</code></td> <td>{$type}</td> <td>{$result}</td> </tr>"; } echo '</table>'; ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 2001:861:3483:a1f0:e9f2:c7fb:7f14:64d) ---- Manual Page -- https://php.net/manual/en/function.empty.php Edit -- https://main.php.net/note/edit/130435 Del: integrated -- https://main.php.net/note/delete/130435/integrated Del: useless -- https://main.php.net/note/delete/130435/useless Del: bad code -- https://main.php.net/note/delete/130435/bad+code Del: spam -- https://main.php.net/note/delete/130435/spam Del: non-english -- https://main.php.net/note/delete/130435/non-english Del: in docs -- https://main.php.net/note/delete/130435/in+docs Del: other reasons-- https://main.php.net/note/delete/130435 Reject -- https://main.php.net/note/reject/130435 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#222293) next »