note 46185 added to function.preg-replace

From: Date: Fri, 01 Oct 2004 16:20:14 +0000
Subject: note 46185 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-77689@lists.php.net to get a copy of this message
I noted that using preg_replace to add a front and back slash to a word it responded in a strange way. For example to replace "PCRE" by "/PCRE/". Using: <?php preg_replace("/.*/", "/$0", "PCRE"); ?> returns "/PCRE" and using: <?php preg_replace("/.*/", "/$0/", "PCRE"); ?> returns "/PCRE///". I unknown why this happen. Daniel. ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46185 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46185&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+46185&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#77689) next »