3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = '<rss version="2.0" xmlns:a10="http://www.w3.org/2005/Atom"> <channel> <title>mMin title</title> <description>Some description</description> <managingEditor>john.doe@example.com</managingEditor> <category>Some category</category> <item> <guid isPermaLink="false">1</guid> <link>https://example.com/1</link> <title>Some title 1</title> <a10:updated>2017-05-30T13:20:22+02:00</a10:updated> <a10:content type="text/xml"> <Location>San diego</Location> <PublishedOn>2016-10-21T11:21:07</PublishedOn> <Body>Lorem ipsum dolar</Body> <JobCountry>USA</JobCountry> </a10:content> </item> <item> <guid isPermaLink="false">1</guid> <link>https://example.com/2</link> <title>Some title 2</title> <a10:updated>2017-05-30T13:20:22+02:00</a10:updated> <a10:content type="text/xml"> <Location>Detroit</Location> <PublishedOn>2016-10-21T11:21:07</PublishedOn> <Body>Lorem ipsum dolar</Body> <JobCountry>USA</JobCountry> </a10:content> </item> <item> <guid isPermaLink="false">1</guid> <link>https://example.com/3</link> <title>Some title 3</title> <a10:updated>2017-05-30T13:20:22+02:00</a10:updated> <a10:content type="text/xml"> <Location>Los Angeles</Location> <PublishedOn>2016-10-21T11:21:07</PublishedOn> <Body>Lorem ipsum dolar</Body> <JobCountry>USA</JobCountry> </a10:content> </item> </channel> </rss>'; $dom = new DOMDocument(); $dom->loadXML($xml); $items = $dom->getElementsByTagName('item'); $array = array(); foreach($items as $item) { $title = $item->getElementsByTagName('title')->item(0)->nodeValue; $link = $item->getElementsByTagName('link')->item(0)->nodeValue; $updated = $item->getElementsByTagName('updated')->item(0)->nodeValue; $location = $item->getElementsByTagName('Location')->item(0)->nodeValue; $pub = $item->getElementsByTagName('PublishedOn')->item(0)->nodeValue; $body = $item->getElementsByTagName('Body')->item(0)->nodeValue; $job = $item->getElementsByTagName('JobCountry')->item(0)->nodeValue; $array[] = [ 'title' => $title, 'link' => $link, 'updated' => $updated, 'Location' => $location, 'PublishedOn' => $pub, 'Body' => $body, 'JobCountry' => $job, ]; } var_dump($array);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> array(7) { ["title"]=> string(12) "Some title 1" ["link"]=> string(21) "https://example.com/1" ["updated"]=> string(25) "2017-05-30T13:20:22+02:00" ["Location"]=> string(9) "San diego" ["PublishedOn"]=> string(19) "2016-10-21T11:21:07" ["Body"]=> string(17) "Lorem ipsum dolar" ["JobCountry"]=> string(3) "USA" } [1]=> array(7) { ["title"]=> string(12) "Some title 2" ["link"]=> string(21) "https://example.com/2" ["updated"]=> string(25) "2017-05-30T13:20:22+02:00" ["Location"]=> string(7) "Detroit" ["PublishedOn"]=> string(19) "2016-10-21T11:21:07" ["Body"]=> string(17) "Lorem ipsum dolar" ["JobCountry"]=> string(3) "USA" } [2]=> array(7) { ["title"]=> string(12) "Some title 3" ["link"]=> string(21) "https://example.com/3" ["updated"]=> string(25) "2017-05-30T13:20:22+02:00" ["Location"]=> string(11) "Los Angeles" ["PublishedOn"]=> string(19) "2016-10-21T11:21:07" ["Body"]=> string(17) "Lorem ipsum dolar" ["JobCountry"]=> string(3) "USA" } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
53.25 ms | 3223 KiB | 4 Q