3v4l.org

run code in 300+ PHP versions simultaneously
<?php //this code will append a &mobileapp to every https://example.com url and http://foobar.com url ob_start(); ?> <html> <head> </head> <body> <a href="http://foobar.com"> http://www.example.com/~hillybilly/foobar.php silly silly </body> </html> <?php $html = ob_get_clean(); $append = 'mobileapp'; $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DOMXpath($doc); $elements = $xpath->query('//*[@href OR @src OR @action]'); if (!is_null($elements)) { foreach ($elements as $element) { switch ($element->nodeName) { case 'a': $element->setAttribute('href', $element->getAttribute('href') . $append); } } } echo $doc->saveHtml();
Output for git.master, git.master_jit
Warning: DOMXPath::query(): Invalid predicate in /in/ZsH4B on line 23 Warning: DOMXPath::query(): Invalid expression in /in/ZsH4B on line 23 Warning: foreach() argument must be of type array|object, bool given in /in/ZsH4B on line 25 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head></head><body> <a href="http://foobar.com"> http://www.example.com/~hillybilly/foobar.php silly silly </a></body></html>
Output for rfc.property-hooks
Warning: DOMXPath::query(): Invalid predicate in /in/ZsH4B on line 23 Warning: DOMXPath::query(): Invalid expression in /in/ZsH4B on line 23 Warning: foreach() argument must be of type array|object, false given in /in/ZsH4B on line 25 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head></head><body> <a href="http://foobar.com"> http://www.example.com/~hillybilly/foobar.php silly silly </a></body></html>

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:
38.99 ms | 402 KiB | 8 Q