note 111367 added to language.types.array
| From: | gtisza at gmail dot com | Date: | Tue, 12 Feb 2013 14:17:28 +0000 |
| Subject: | note 111367 added to language.types.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193616@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.199
Probable Submitter: 217.110.53.72
----
Manual Page -- http://php.net/manual/en/language.types.array.php
Edit -- https://master.php.net/note/edit/111367
Del: integrated -- https://master.php.net/note/delete/111367/integrated
Del: useless -- https://master.php.net/note/delete/111367/useless
Del: bad code -- https://master.php.net/note/delete/111367/bad+code
Del: spam -- https://master.php.net/note/delete/111367/spam
Del: non-english -- https://master.php.net/note/delete/111367/non-english
Del: in docs -- https://master.php.net/note/delete/111367/in+docs
Del: other reasons-- https://master.php.net/note/delete/111367
Reject -- https://master.php.net/note/reject/111367
Search -- https://master.php.net/manage/user-notes.php