note 120722 deleted from reserved.variables.get by peehaa
| From: | peehaa@php.net | Date: | Sun, 28 Apr 2019 10:59:03 +0000 |
| Subject: | note 120722 deleted from reserved.variables.get by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210850@lists.php.net to get a copy of this message | ||
Note Submitter: nggit at anggit dot com
----
Sometimes I do not want to use isset() or array_key_exists() to check the index exists or not, but
rather choose to define in advance. Union array operator is pretty handy for me:
<?php
$_GET += array('foo' => null, 'bar' => null); // define
echo $_GET['foo'];
echo $_GET['baz']; // Notice: Undefined index: baz in...
?>