[development] Drupal - to use objects or arrays

Bèr Kessels ber at webschuur.com
Thu Jan 11 16:58:54 UTC 2007


Hi,

Op dinsdag 9 januari 2007 22:57, schreef Doug Green:
> To use objects or arrays?  What is the "Drupal way"?  I'd rather write code
> using objects (php's stdClass).  But I've run into a ton of problems using
> objects on php4.

My general advice is: use what suits best at that moment, but lean as much as 
posible towards arrays.

The reason is that Drupal is moving away from objects, slowly: Some gnomes in 
Drupal Core have been working very hard at replacing objects for arrays last 
two releases. They even invented a syntax that allows arrays to look and act 
a little like objects array('#foo' => $bar). 
The reasons people chose this are both religious and pragmatic, and it is a 
can of worms as you can see on other branches of this thread :)

So, this seems to be, or else become, the "Drupal way". 

Bèr
-- 
Drupal, Ruby on Rails and Joomla! development: webschuur.com | Drupal hosting: 
www.sympal.nl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20070111/1aa673de/attachment.pgp 


More information about the development mailing list