note 16456 deleted from function.preg-replace by sniper
| From: | sniper@php.net | Date: | Fri, 17 Oct 2003 03:53:33 +0000 |
| Subject: | note 16456 deleted from function.preg-replace by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58737@lists.php.net to get a copy of this message | ||
Note Submitter: jolt@nospam.com
----
It has been mentioned up above that using a subpattern as a key to lookup a value in an associative
array is not possible. After much trial and error, I found this not to be the case - here is how to
do it:
$result = preg_replace('/%%(.*)%%/sUe', "\$array['\\1']", $ascii);
I hope this helps somebody as it took me a while to figure out. Thanks to everybody else who have
contributed their notes as well.