3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmlStr = '<?xml version="1.0"?><toplevel><CompleteSuggestion><suggestion data="ski360"/></CompleteSuggestion><CompleteSuggestion><suggestion data="ski 39"/></CompleteSuggestion><CompleteSuggestion><suggestion data="ski35"/></CompleteSuggestion><CompleteSuggestion><suggestion data="ski 3000"/></CompleteSuggestion><CompleteSuggestion><suggestion data="ski 33"/></CompleteSuggestion><CompleteSuggestion><suggestion data="ski 34"/></CompleteSuggestion></toplevel>'; $xmlObj = simplexml_load_string(utf8_encode($xmlStr)); //var_dump($xmlObj); if ($xmlObj !== false) { $xmlArr = objectsIntoArray($xmlObj); var_dump($xmlArr); } function objectsIntoArray($arrObjData, $arrSkipIndices = array()) { $arrData = array(); if ($arrObjData instanceof SimpleXMLElement) { $suggestions = $xml->xpath('/CompleteSuggestion/suggestion/@data'); while(list($test, $node) = each($suggestions)) { echo $test, $node,"\n"; } // $arrObjData = get_object_vars($arrObjData); } if (is_array($arrObjData)) { foreach ($arrObjData as $index => $value) { if (is_object($value) || is_array($value)) { $value = objectsIntoArray($value, $arrSkipIndices); } if (in_array($index, $arrSkipIndices)) { continue; } $arrData[$index] = $value; } } return $arrData; }
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Function utf8_encode() is deprecated in /in/GfaaY on line 4 Warning: Undefined variable $xml in /in/GfaaY on line 15 Fatal error: Uncaught Error: Call to a member function xpath() on null in /in/GfaaY:15 Stack trace: #0 /in/GfaaY(7): objectsIntoArray(Object(SimpleXMLElement)) #1 {main} thrown in /in/GfaaY on line 15
Process exited with code 255.

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:
24.95 ms | 401 KiB | 8 Q