[TYPO3-core] preg_replace / back references

Ernesto Baschny [cron IT] ernst at cron-it.de
Tue Jun 26 11:33:15 CEST 2007


Dmitry Dulepov wrote: on 26.06.2007 11:23:

> Wolfgang Klinger wrote:
>> Patch attached.
>> Please approve.
> 
> By the way, why it is not simple '\1'?
> 
> I see no problem with ${1} because it is standard syntax but just
> curious...

Probably because php documentation recommends using $n. From
http://www.php.net/manual/en/function.preg-replace.php

    replacement may contain references of the form \\n or (since PHP
4.0.4) $n, with the latter form being the preferred one.

Probably they just copied the recommendation from perlre man page. See:

http://www.perl.com/doc/manual/html/pod/perlre.html#WARNING_on_1_vs_1


Cheers,
Ernesto


More information about the TYPO3-team-core mailing list