View Full Version : preg_replace (don't know how to describe it)

02-24-2007, 03:19 PM
$string="nice to meet you [phpfile=new]";

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.


- Mike

02-26-2007, 05:15 AM
What is $1

php.net example

$string = 'April 15, 2003';
$pattern = '/(\w+) (\d+), (\d+)/i';
$replacement = '${1}1,$3';
echo preg_replace($pattern, $replacement, $string);

Hopefully this will help you

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum