3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = <<<DATA <file_allegati> <allegato id="0" planimetria="0" type="foto"> <id>0</id> <file_path>https://##.jpg </file_path> </allegato> <allegato id="1" planimetria="1" type="planimetria"> <id>1</id> <file_path>https://##.jpg </file_path> </allegato> </file_allegati> DATA; function set_planimetrie($allegati) { $result = ''; $xml = new SimpleXMLElement($allegati); foreach ($xml->children() as $allegato) { if ((string)$allegato['type'] === 'planimetria' && (string)$allegato['planimetria'] === "1") { if ($result !== '') { $result .= ','; } $result .= $allegato->file_path; } } return $result; } var_dump(set_planimetrie($data));
Output for git.master, git.master_jit, rfc.property-hooks
string(15) "https://##.jpg "

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:
117.65 ms | 405 KiB | 5 Q