NYCPHP Meetup

NYPHP.org

[nycphp-talk] Top 5 Most Useful PHP Functions?

David Mintz dmintz at davidmintz.org
Fri Nov 12 09:33:40 EST 2004


On Thu, 11 Nov 2004, Adam Maccabee Trachtenberg wrote:

>
> 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.

Indeed, is there any other one-liner in PHP to snag just the 1st element
of something that returns an array?

---
David Mintz
http://davidmintz.org/

$world =~ s|<bush[^>]*>.+</bush>||is;



More information about the talk mailing list