|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-11-22 18:45 UTC] edink@php.net
[2002-01-15 07:19 UTC] lobbin@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 22 07:00:01 2025 UTC |
Using the following code (which someone may do accidentally): $myarray = array("X" => "A", "Y" => "B", "Z" => "C"); foreach($myarray as $key->$value) { ... } causes PHP (on each iteration) to create an object $key with the value of the current array element in a property with a blank name (because $value has just been created, and is therefore empty). The following var_dump() output illustrates: object(stdClass)(1) { [""]=> string(1) "A" } The creation of objects with blank property names seems like it shouldn't be possible (even unintentionally)!