plain $myarray['var'] = "val"; should generate a notice in case you haven't declared $myarray as an array (atleast if it's not introduced at all). Also, I really disagree with you. It can be a LOT easier to use array().
You can do this:
PHP Code:
$variable["key"]["another_key"]["yet_another_key"] = array(
"name" => "Mike",
"id" => 1,
"email" => "moo@example.com"
);
When using "your" method you'd have to do this:
PHP Code:
$variable["key"]["another_key"]["yet_another_key"]["name"] = "Mike";
$variable["key"]["another_key"]["yet_another_key"]["id"] = 1;
$variable["key"]["another_key"]["yet_another_key"]["email"] = "moo@example.com";
And about multidimensional arrays: It's possible and not even hard. But yes, it is easier to write just $variable["key"]["another_key"]["yet_another_key"]["name"]. I can't disagree with that.
The methods can also be combined.
PHP Code:
$a = array();
$a["key"] = "value";
I see nothing wrong with that piece of code.

Originally Posted by
Infizi
its not just this, theres millions of stupid things appearing that no one ever uses in reality, PHP is just getting so advanced its rewriting itself....
Taking the short way usually generates notices, and one should never, I repeat, NEVER EVER ignore notices. It's ok if you develop just for yourself, but when it's about commercial/open source products.. It's a shame. It clearly shows that the developers have not been very careful when writing the code. I'd never buy a product that generates notices. Never. And register_globals... If I could, I'd take computers away from anyone using register_globals.
Sorry if this post seems a bit aggressive but I just.. Oh well. I guess I made it quite clear.
Bookmarks