note 75965 added to function.eregi-replace

From: Date: Sun, 24 Jun 2007 19:49:31 +0000
Subject: note 75965 added to function.eregi-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-127931@lists.php.net to get a copy of this message
Melissa, This one is a better setup for your marvelous code. It handles Melissa Magic and also Magic Melissa function underline($subject, $word) { $mywords = explode(" ",$word); for ($j=0;$j<count($mywords);$j++) { $regex_chars = '\.+?(){}[]^$'; for ($i=0; $i<strlen($regex_chars); $i++) { $char = substr($regex_chars, $i, 1); $mywords[$j] = str_replace($char, '\\'.$char, $mywords[$j]); } $mywords[$j] = '(.*)('.$mywords[$j].')(.*)'; $subject = eregi_replace($mywords[$j], '\1<span style="background:#ACA;padding:0;margin:0;">\2</span>\3', $subject); } return $subject; } ---- Server IP: 195.221.21.36 Probable Submitter: 82.245.163.29 ---- Manual Page -- http://www.php.net/manual/en/function.eregi-replace.php Edit -- https://master.php.net/note/edit/75965 Del: integrated -- https://master.php.net/note/delete/75965/integrated Del: useless -- https://master.php.net/note/delete/75965/useless Del: bad code -- https://master.php.net/note/delete/75965/bad+code Del: spam -- https://master.php.net/note/delete/75965/spam Del: non-english -- https://master.php.net/note/delete/75965/non-english Del: in docs -- https://master.php.net/note/delete/75965/in+docs Del: other reasons-- https://master.php.net/note/delete/75965 Reject -- https://master.php.net/note/reject/75965 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127931) next »