[nycphp-talk] Top 5 Most Useful PHP Functions?
Adam Maccabee Trachtenberg
adam at trachtenberg.com
Thu Nov 11 16:25:50 EST 2004
On Thu, 11 Nov 2004, Andrew Yochum wrote:
> On Wed, Nov 10, 2004 at 11:21:06PM -0500, csnyder wrote:
> > And if I had to pick a control structure it would be foreach. I mean,
> > does anyone use list() anymore?
>
> Yes. I frequently use it like this:
> List($A['Value1'], $A['Value2'], /*Junk*/ ) = Explode($Some_Delimeter, $Some_String);
I used it today when I had to use SimpleXML / XPath to extract an
attribute from a specific part of an XML file:
list($version) = simplexml_load_string($xml)->xpath('/foo[@bar = "baz"]/@version');
The xpath() method returns an array of items, but I know I'm only
interested in the first (and only) one.
-adam
--
adam at trachtenberg.com
author of o'reilly's "upgrading to php 5" and "php cookbook"
avoid the holiday rush, buy your copies today!
More information about the talk
mailing list