xcow
02-24-2007, 03:19 PM
$variable["new"]="hi";
$variable["cow"]="wow";
$string="nice to meet you [phpfile=new]";
$pattern='/\[phpfile=(\w+)\]/i';
$replace=$variable["$1"];
preg_replace($pattern,$replace,$string);
When I tried this, it gave me an error about $1 not existing. Does anyone know how to solve this? I have also tried \\1, and tried heck alot of different things, but couldn't resolve this.
Thanks..
- Mike
$variable["cow"]="wow";
$string="nice to meet you [phpfile=new]";
$pattern='/\[phpfile=(\w+)\]/i';
$replace=$variable["$1"];
preg_replace($pattern,$replace,$string);
When I tried this, it gave me an error about $1 not existing. Does anyone know how to solve this? I have also tried \\1, and tried heck alot of different things, but couldn't resolve this.
Thanks..
- Mike