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 | @src | @action]'); class RELAppender{ private $domains_to_append = array(); private $append_get = ''; private $no_domains = true; public function __construct($domains_to_append, $append_get, $no_domains = true){ $this->domains_to_append = $domains_to_append; $this->append_get = 'mobileapp'; } public function replace_url($url){ if ($this->no_domains){ if (strpos('http://', $url) === false && strpos('https://', $url) === false){ } } if (strpos('?', $url) !== false){ return $url .= '&'.$this->append_get }else{ return $url .= '?'.$this->append_get; } return $url; } } $rel = new RELAppender(array('http://example.com','https://example.org'),'mobileapp', true) if (!is_null($elements)) { foreach ($elements as $element) { var_dump($element); if ($element->hasAttribute('href')){ $url = $element->getAttribute('href'); $newurl = $rel->replace_url($url); $element->setAttribute('href', $newurl); } } } echo $doc->saveHtml();

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.240.0060.03712.40
5.4.230.0060.04012.39
5.4.220.0070.03612.40
5.4.210.0050.03712.39
5.4.200.0060.03912.39
5.4.190.0060.03612.39
5.4.180.0070.03712.39
5.4.170.0070.03512.40
5.4.160.0060.03812.39
5.4.150.0040.03912.39
5.4.140.0060.04212.08
5.4.130.0040.04312.06
5.4.120.0070.04312.03
5.4.110.0080.04212.02
5.4.100.0070.04212.02
5.4.90.0090.04112.02
5.4.80.0090.03512.03
5.4.70.0050.03612.02
5.4.60.0040.03512.02
5.4.50.0040.03612.02
5.4.40.0070.03712.00
5.4.30.0050.04212.00
5.4.20.0080.03512.00
5.4.10.0050.03812.00
5.4.00.0050.03811.49
5.3.280.0050.04112.71
5.3.270.0050.04212.72
5.3.260.0070.03712.72
5.3.250.0050.03712.72
5.3.240.0070.04112.72
5.3.230.0050.03812.71
5.3.220.0050.03812.68
5.3.210.0040.04012.68
5.3.200.0090.03712.68
5.3.190.0070.03812.68
5.3.180.0050.03812.67
5.3.170.0070.03412.67
5.3.160.0070.04112.68
5.3.150.0050.04112.67
5.3.140.0050.03712.66
5.3.130.0050.03812.66
5.3.120.0070.03912.66
5.3.110.0060.03812.66
5.3.100.0060.03612.13
5.3.90.0040.03812.10
5.3.80.0060.03712.09
5.3.70.0070.03812.09
5.3.60.0040.03912.07
5.3.50.0070.03912.02
5.3.40.0040.03812.02
5.3.30.0070.03311.98
5.3.20.0060.03511.76
5.3.10.0070.03611.72
5.3.00.0080.03611.71

preferences:
130.78 ms | 1398 KiB | 7 Q