note 71756 deleted from function.preg-replace by colder
| From: | colder@php.net | Date: | Mon, 18 Jun 2007 20:07:26 +0000 |
| Subject: | note 71756 deleted from function.preg-replace by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127714@lists.php.net to get a copy of this message | ||
Note Submitter: jasper at no dot spam dot no dot spam dot live dot nl
----
@ 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.