note 51980 rejected from function.preg-replace by victor
| From: | victor@php.net | Date: | Mon, 18 Apr 2005 06:18:19 +0000 |
| Subject: | note 51980 rejected from function.preg-replace by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-88144@lists.php.net to get a copy of this message | ||
Note Submitter: jcscott at scottcomm dot com
----
Don't know if this a bug or not, but using a Windows NT localhost 5.0 build 2195 (PHP 4.3.1) I
noticed that preg_replace will actually replace a $GLOBALS variable rather than making the
replacement just to a new variable, ie:
<?php
$GLOBALS['mainurl'] = "http://www.website.com/";
//remove last slash
$mainurl = preg_replace("|/$|", "", $GLOBALS['mainurl']);
?>
results in
$GLOBALS['mainurl'] = "http://www.website.com"
and
$mainurl = "http://www.website.com"
I'm under the impression that $GLOBALS variables are distinct from local variables of the same
name. Then again, I could be wrong.