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; ?>
Output for 7.0.0
Parse error: syntax error, unexpected '"', expecting ',' or ')' in /in/L62bD on line 9
Process exited with code 255.
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
Parse error: syntax error, unexpected '{' in /in/L62bD on line 9
Process exited with code 255.

preferences:
169.48 ms | 1395 KiB | 24 Q