[drupal-devel] multidimensional arrays VS objects. should we go for one?

Bèr Kessels ber at webschuur.com
Mon Oct 10 17:10:05 UTC 2005


On Monday 10 October 2005 17:55, Gabor Hojtsy wrote:
> > IMO the clean way is to have arrays when the data is NOT structured, but
> > is a list of similar items, but to have objects when it is structured. so
> > $menu_item->path instead of $menu_item['path']. just like we have for
> > most 'things' like nodes, comments, terms, etc. But all these $menu_items
> > should sit in a $items array, not in $items->item1, $items->item2.
> > Most of this is in place already, but not all. Keeping Drupal clean means
> > deciding on standards like these too, IMO.
>
> Agreead. Structured data vs. list data is a good separation indicator.I

If more people agree, then we can make a few issues called "rewrite menu to 
use objects, instead of keyed arrays" and so. And add a few lines to the 
coding guidelines.

Not that I think that menus will ever be rewritten, but it /should/ be done, 
if we want real clan and consisten code. 
Its more a thing that we can say 'from now on we do it this way'

Bèr



More information about the drupal-devel mailing list