3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $text = "demo link edno www.abv.bg link 2 http://abv123.bg/"; $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; preg_match_all($reg_exUrl, $text, $matches); $usedPatterns = array(); foreach($matches[0] as $pattern){ if(!array_key_exists($pattern, $usedPatterns)){ $usedPatterns[$pattern]=true; $text = str_replace ($pattern, "<a href="{$pattern}" rel="nofollow">{$pattern}</a> ", $text); } } echo $text;
Output for 5.3.0 - 5.4.28
Parse error: syntax error, unexpected '{' in /in/FG4C9 on line 9
Process exited with code 255.