MockY Posted March 4, 2010 Share Posted March 4, 2010 I got the following code from some tutorial long time ago and never really looked into why it works. The only thing I have changed is that links open up in a new window by adding a target property to the <a> tag. It basically makes potential links clickable once the user posts a message in a guestbook. function href($text) { $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','<a href="\\1" target="_blank">\\1</a>', $text); $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1<a href="http://\\2" target="_blank">\\2</a>', $text); $text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})','<a href="mailto:\\1">\\1</a>', $text); return $text; } After a PHP upgrade, everywhere I use eregi_replace, notifications about eregi_replace (and it's siblings) are printed but still works. Since I obviously want to replace these functions with functions that will work even when PHP6 rolls out without disabling error printing in php.ini, getting some help in terms of altering them would be much appreciated. So how would I change this function to work in similar way? Link to comment https://forums.phpfreaks.com/topic/194069-need-help-with-changing-eregi_replace-after-php-upgrade/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.