3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = ' <span class="phone-number" data-id="999" style="{lots of random stuff here}">+61 9900 0000</span> <span class="email" data-something="xxx" style="{lots of random stuff here}">test@test.com</span> '; $dom = new DOMDocument; $dom->loadHtml($html); $xpath = new DOMXPath($dom); $phone = $xpath->query("//span[contains(@class, 'phone-number')]"); $email = $xpath->query("//span[contains(@class, 'email')]"); echo $phone->item(0)->nodeValue.PHP_EOL; echo $email->item(0)->nodeValue.PHP_EOL; /* foreach ($phone as $value) { echo $value->nodeValue; } */
Output for git.master, git.master_jit, rfc.property-hooks
+61 9900 0000 test@test.com

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