note 16456 added to function.preg-replace
| From: | jolt at nospam dot com | Date: | Wed, 31 Oct 2001 17:49:34 +0000 |
| Subject: | note 16456 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-19703@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/function.preg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+16456
http://master.php.net/manage/user-notes.php?action=delete+16456
http://master.php.net/manage/user-notes.php?action=reject+16456