note 111367 deleted from language.types.array by cmb

From: Date: Thu, 25 Aug 2016 11:45:13 +0000
Subject: note 111367 deleted from language.types.array by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-206385@lists.php.net to get a copy of this message
Note Submitter: gtisza at gmail dot com ---- Be very careful when using a result as an array. <?php echo $a['foo']['bar']['baz'] ?> will throw an error if $a is an object, and throw a warning if $a is an array but does not have the right keys, but it will silently return true if $a is null or boolean or int, and if $a is a string, it will return its first character. (This is true even with E_STRICT set.) This can be a major gotcha with functions which return null or false if they are unsuccessful.

« previous php.notes (#206385) next »