3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">10</int> <lst name="params"> <str name="q">*:*</str> <str name="facet.field">main</str> <str name="facet.mincount">1</str> <str name="rows">0</str> <str name="facet">on</str> </lst> </lst> <lst name="responseHeader"> <int name="status">1</int> <int name="QTime">11</int> <lst name="params"> <str name="q">*:*</str> <str name="facet.field">main</str> <str name="facet.mincount">1</str> <str name="rows">0</str> <str name="facet">on</str> </lst> </lst> <result name="response" numFound="5473" start="0"/> <lst name="facet_counts"> <lst name="facet_queries"/> <lst name="facet_fields"> <lst name="main"> <int name="Victoria University Photograph Collection">1693</int> </lst> </lst> </lst> </response> XML; $input = simplexml_load_string($xml); $items = $input->xpath('/response/lst//*'); $arr = []; foreach ($items as $item) { if (isset($item->attributes()->name) && trim((string)$item) !== "") { $arr[] = [(string)$item->attributes()->name => (string)$item]; } } print_r($arr);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [status] => 0 ) [1] => Array ( [QTime] => 10 ) [2] => Array ( [q] => *:* ) [3] => Array ( [facet.field] => main ) [4] => Array ( [facet.mincount] => 1 ) [5] => Array ( [rows] => 0 ) [6] => Array ( [facet] => on ) [7] => Array ( [status] => 1 ) [8] => Array ( [QTime] => 11 ) [9] => Array ( [q] => *:* ) [10] => Array ( [facet.field] => main ) [11] => Array ( [facet.mincount] => 1 ) [12] => Array ( [rows] => 0 ) [13] => Array ( [facet] => on ) [14] => Array ( [Victoria University Photograph Collection] => 1693 ) )

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:
28.63 ms | 409 KiB | 5 Q