note 71756 added to function.preg-replace
| From: | jasper at no dot spam dot no dot spam dot live dot nl | Date: | Thu, 14 Dec 2006 13:41:59 +0000 |
| Subject: | note 71756 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120606@lists.php.net to get a copy of this message | ||
@ jlockhar at vt dot edu
i see your problem, you are concentating (sp) the arrays into the replacement rather then actually
supplying the array to preg_replace.
you could try this:
<?php
foreach($links as $key => $val) {
$links[$key] = '<a href="' . $val . '">$0</a>';
}
$whatsnew = preg_replace($terms, $links, $source);
?>
There probably is a better way to do this but this should work aswell.
----
Server IP: 194.109.193.94
Probable Submitter: 80.57.167.226
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/71756
Del: integrated -- https://master.php.net/note/delete/71756/integrated
Del: useless -- https://master.php.net/note/delete/71756/useless
Del: bad code -- https://master.php.net/note/delete/71756/bad+code
Del: spam -- https://master.php.net/note/delete/71756/spam
Del: non-english -- https://master.php.net/note/delete/71756/non-english
Del: in docs -- https://master.php.net/note/delete/71756/in+docs
Del: other reasons-- https://master.php.net/note/delete/71756
Reject -- https://master.php.net/note/reject/71756
Search -- https://master.php.net/manage/user-notes.php