Jon Baer wrote:
Do many here use the SPL library?


I use the ArrayAccess interface all the time. It allows me to get some OOP benefits for data structures while still having the ease of use of an array.

For example, we opened up a SOAP interface for our system. Internally we had things working as arrays but in order to provider more structure for the web service, we needed to have objects. Instead of rewriting the whole code base, I just made a few new classes which implemented ArrayAccess, changed $thing = array(); to $thing = new ArrayLikeObject(); and left the rest of the code alone. The rest of the code still does things like $thing[$key] = $var; but the SOAP interface has the objects it needs. It saved us from a lot of extra work rewriting tons of code.

--
Scott Mattocks
Author: Pro PHP-GTK
http://www.crisscott.com
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to