3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<DATA <div class="list"> <div class="ui_checkbox type hidden" data-categories="57 48 "> <input id="attraction_type_119" type="checkbox" value="119" <label for="attraction_type_119">Aquariums</label> </div> <div class="ui_checkbox type " data-categories="47 "> <input id="attraction_type_120" type="checkbox" value="120" <label for="attraction_type_120">Arènes et stades</label> </div> </div> DATA; $data = array(); $dom = new DOMDocument(); @$dom->loadHTML($html); $xp = new DOMXpath($dom); $items = $xp->query('//div[@class="list"]/div'); foreach($items as $item) { $temp["data_categorie"] = $item->getAttribute("data-categories"); foreach ($item->childNodes as $child) { if ($child->nodeName === "input") { $temp["input_value"] = $child->getAttribute("value"); $temp["label_text"] = $child->nextSibling->nodeValue; } } $data[] = $temp; } print_r($data);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [data_categorie] => 57 48 [input_value] => 119 [label_text] => Aquariums ) [1] => Array ( [data_categorie] => 47 [input_value] => 120 [label_text] => Arènes et stades ) )

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:
26.26 ms | 406 KiB | 5 Q