Return first index of an array that has been returned by ...
Posted: Thu May 22, 2008 8:38 pm
How do I return the first index of an array that was returned by a object method?
This gives me an error. O.o
How do I get the first element of the array that's returned by get_elements_by_tagname() method in one expression?
I know I could easily do this:
But like I said I want it all in one expression.
Thanks for reading.
Code: Select all
$dom->get_elements_by_tagname("location")[0]
How do I get the first element of the array that's returned by get_elements_by_tagname() method in one expression?
I know I could easily do this:
Code: Select all
$location = $dom->get_elements_by_tagname("location");
$location = $location[0];
Thanks for reading.