3v4l.org

run code in 300+ PHP versions simultaneously
<?php function add_href_to_links($text) { // The Regular Expression filter $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; // Check if there is a url in the text if(preg_match($reg_exUrl, $text, $url)) { return preg_replace($reg_exUrl, "<a href="{$url[0]}">{$url[0]}</a> ", $text); } else { // if no urls in the text just return the text return $text; } } $str = 'שלום שלום\nhttps://www.youtube.com/watch?v=2w0JiLKQ3-o\n"asd" ש`מגניב'; $str=strip_tags($str,'<div><br><a><p><b><span>'); $str = str_replace('\r\n','',$str); $str = add_href_to_links($str); echo $str; ?>

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)
7.0.00.0170.04320.32
5.6.160.0070.07320.54
5.6.150.0100.04718.19
5.6.140.0070.08018.16
5.6.130.0000.08018.25
5.6.120.0030.04021.12
5.6.110.0100.08021.14
5.6.100.0000.04321.03
5.6.90.0000.04320.98
5.6.80.0130.04020.47
5.5.300.0100.07318.07
5.5.290.0070.08317.94
5.5.280.0070.08320.80
5.5.270.0230.06720.62
5.5.260.0130.08020.89
5.5.250.0030.07720.69
5.5.240.0170.04320.04

preferences:
141.96 ms | 1386 KiB | 7 Q