note 72077 deleted from function.isset by cmb
| From: | cmb@php.net | Date: | Sun, 05 Jan 2020 08:11:44 +0000 |
| Subject: | note 72077 deleted from function.isset by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213740@lists.php.net to get a copy of this message | ||
Note Submitter: beuc at beuc dot net
----
Beware that the chk() function below creates the variable or the array index if it didn't
existed.
<?php
function chk(&$var) {
if (!isset($var))
return NULL;
else
return $var;
}
echo '<pre>';
$a = array();
var_dump($a);
chk($a['b']);
var_dump($a);
echo '</pre>';
// Gives:
// array
// empty
//
// array
// 'b' => null
?>