3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $js_date = "12.12.2013"; $js_time = "10.00"; $str = 'http://www.abctehno.ee'; function auto_link($str, $type = 'both', $popup = FALSE) { if ($type != 'email') { if (preg_match_all("#(^|\s|\()((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches)) { $pop = ($popup == TRUE) ? " target=\"_blank\" " : ""; for ($i = 0; $i < sizeof($matches['0']); $i++) { $period = ''; if (preg_match("|\.$|", $matches['6'][$i])) { $period = '.'; $matches['6'][$i] = substr($matches['6'][$i], 0, -1); } $str = str_replace($matches['0'][$i], $matches['1'][$i].'<a href="http'. $matches['4'][$i].'://'. $matches['5'][$i]. $matches['6'][$i].'"'.$pop.'>http'. $matches['4'][$i].'://'. $matches['5'][$i]. $matches['6'][$i].'</a>'. $period, $str); } } } if ($type != 'url') { if (preg_match_all("/([a-zA-Z0-9_\.\-]+)@([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-\.]*)/i", $str, $matches)) { for ($i = 0; $i < sizeof($matches['0']); $i++) { $period = ''; if (preg_match("|\.$|", $matches['3'][$i])) { $period = '.'; $matches['3'][$i] = substr($matches['3'][$i], 0, -1); } $str = str_replace($matches['0'][$i], safe_mailto($matches['1'][$i].'@'.$matches['2'][$i].'.'.$matches['3'][$i]).$period, $str); } } } return $str; } $email_message ="\n Lugupeetud klient, \n \n teile broneeritud ülevaatuse aeg on ".$js_date." kell ".$js_time.". \n ABC Tehno asub aadressil Sõpruse pst 27, tel: 6 999 227, email: info@abc.ee, koduleht: ".$str.".\n Tuletame meelde, et hilinemisel kaotab broneering kehtivuse. \n \n Kohtumiseni, \n ABC Tehno";; echo $email_message; ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Lugupeetud klient, teile broneeritud ülevaatuse aeg on 12.12.2013 kell 10.00. ABC Tehno asub aadressil Sõpruse pst 27, tel: 6 999 227, email: info@abc.ee, koduleht: http://www.abctehno.ee. Tuletame meelde, et hilinemisel kaotab broneering kehtivuse. Kohtumiseni, ABC Tehno