3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<DATA <p>Lorem Ipsum is simply dummy text</p> <p>Lorem Ipsum is <a href="http://www.google.com">simply</a> dummy text</p><a href="http://www.youtube.com/watch?v=DUQi_R4SgWo" target="_blank" rel="noopener">Check out the video here!</a>. <p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</p> <a href="http://www.youtube.com/watch?v=A_6gNZCkajU" target="_blank" rel="noopener">Video here</a> <p>It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> DATA; # set up the DOM $dom = new DOMDocument(); $dom->loadHTML($html, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED); # set up the xpath $xpath = new DOMXPath($dom); # set up the regex $xpath->registerNamespace('php', 'http://php.net/xpath'); $xpath->registerPHPFunctions('match'); $links = $xpath->query("a[php:functionString('match', @href)]"); function match($href) { $regex = '~\?v=([^&]+)~'; $rc = preg_match($regex, $href, $matches); var_dump($matches[1]); return $rc; }
Output for git.master, git.master_jit, rfc.property-hooks
Parse error: syntax error, unexpected token "match", expecting "(" in /in/041WD on line 19
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:
166.49 ms | 405 KiB | 5 Q