Skip to content

Instantly share code, notes, and snippets.

@elliotttf
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elliotttf/9074809 to your computer and use it in GitHub Desktop.
Save elliotttf/9074809 to your computer and use it in GitHub Desktop.
elliotttf@4kmba:~$ php /tmp/test.php
Notice: Undefined index: baz in /private/tmp/test.php on line 15
Notice: Undefined index: baz in /private/tmp/test.php on line 16
<?php
error_reporting(E_ALL);
$a = array(
'foo' => array(
'bar' => array()
)
);
if (isset($a['foo']['bar']['baz']['bang']['boom'])) {
print_r($a['foo']['bar']['baz']);
}
// Intentionally raise some notices so we know it's working...
print_r($a['foo']['bar']['baz']);
print_r($a['foo']['bar']['baz']['bang']);
echo PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment