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($buffer); $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, rfc.property-hooks
Warning: Undefined variable $buffer in /in/oPuFL on line 18 Deprecated: DOMDocument::loadHTML(): Passing null to parameter #1 ($source) of type string is deprecated in /in/oPuFL on line 18 Fatal error: Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /in/oPuFL:18 Stack trace: #0 /in/oPuFL(18): DOMDocument->loadHTML('') #1 {main} thrown in /in/oPuFL on line 18
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:
41.15 ms | 401 KiB | 8 Q