The online racing simulator
PHP pattern match backreference question!
(2 posts, started )
Solved: PHP pattern match backreference question!
I know we've got some PHP gurus in here. I've got a line of code that is about to get to the hair-pulling stage, so I'm going for a fag and hoping someone else can give me the correct syntax while I calm down...

I'm trying to use a backreference from a pattern match as an array key in a replacement. Something like this:

preg_replace("/(\w.*?)/", $arr['\\1'], $str);

I've tried $arr['\\1'] and $arr[$1] and various other ways of writing it, and none of them have worked. Anybody?
-
(thisnameistaken) DELETED by thisnameistaken
#2 - filur
Been there.

I think i solved it by using /e, eval.
-
(thisnameistaken) DELETED by thisnameistaken

PHP pattern match backreference question!
(2 posts, started )
FGED GREDG RDFGDR GSFDG