[development] Drupal - to use objects or arrays

George Kappel gkappel at herrspacific.com
Tue Jan 9 22:06:11 UTC 2007


Based on what I have seen you are better off using non-objects for things
you want to cache.  As an example there is a lot less overhead when using
APC with arrays vs objects 


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.

The CiviCRM folks have this handy guide for php5 -> php4:

 

http://wiki.civicrm.org/confluence/display/CRM/Writing+PHP4+Compatible+code

 

But even after using it, I'm having difficulties.  I'm starting to conclude
that I should convert all my object references to arrays.  I only see a
couple of object references in core, and none to anything complicated
(arrays of objects, objects pointing to objects, object elements of arrays
of objects, etc).  

 

Doug Green

www.douggreenconsulting.com <http://www.douggreenconsulting.com/> 

www.civicactions.com

 

Changing the world one node at a time!

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070109/5d9372ea/attachment.htm 


More information about the development mailing list