3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $reg_exUrl = "/(http|https|ftp|ftps|www)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; $text = 'lol www.google.bg is an awesome website;'; if(preg_match($reg_exUrl, $text, $url)) { // make the urls hyper links $new_text = preg_replace($reg_exUrl, '<a href="'.$url[0].'">'.$url[0].'</a> ', $text); } else { // if no urls in the text just return the text echo $text; } echo $new_text;
Output for 5.0.4 - 7.1.0
lol www.google.bg is an awesome website; Notice: Undefined variable: new_text in /in/4uvmr on line 15
Output for 4.3.0 - 5.0.3
lol www.google.bg is an awesome website; Notice: Undefined variable: new_text in /in/4uvmr on line 15