NYCPHP Meetup

[nycphp-talk] passing array/object data

Michael Southwell michael.southwell at nyphp.com
Mon Nov 24 14:14:40 EST 2008


I have a method that takes a parameter that might be either an array or 
a db result object. So on the one hand I might have:
echo $array['stuff'];
or on the other:
echo $result -> stuff;

Right now I'm just using is_array and repeated brute force to do this, 
but obviously there's a better way. What's my best way to abstract this 
so I can use just one echo statement regardless of the parameter?
-- 
=================
Michael Southwell
Vice President, Education
NYPHP TRAINING:  http://nyphp.com/Training/Indepth



More information about the talk mailing list