mzhou88 Posted February 24, 2007 Share Posted February 24, 2007 $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? Thanks.. - Mike Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.