Hello firends
http://www.php.net/manual/en/function.preg-replace.php
May someone give me example about this:
"When working with a replacement pattern where a backreference is immediately followed by another number (i.e.: placing a literal number immediately after a matched pattern), you cannot use the familiar \\1 notation for your backreference. \\11, for example, would confuse preg_replace() since it does not know whether you want the \\1 backreference followed by a literal 1, or the \\11 backreference followed by nothing. In this case the solution is to use \${1}1. This creates an isolated $1 backreference, leaving the 1 as a literal. "
GOOD LUCK!
preg_replace
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Code: Select all
<?php
$string = "I want to make this ten (10) into one hundred and one";
echo preg_replace('/(\d+)/', "\\11", $string);
echo preg_replace('/(\d+)/', "\${1}1", $string);
?>