Re: [PHP4BETA] preg_replace Q
| From: | Cynic | Date: | Thu, 20 Apr 2000 16:46:19 +0000 |
| Subject: | Re: [PHP4BETA] preg_replace Q | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-13808@lists.php.net to get a copy of this message | ||
BTW, problem wasn't that it didn't evaluate, but that it
didn't, and still doesn't replace.
At 09:02 20.4.2000 -0500, Andrei Zmievski wrote the following:
--------------------------------------------------------------
>On Thu, 20 Apr 2000, Cynic wrote:
> > $output = preg_replace( "/\$(\w+)/" , "/\$GLOBALS['\\1']/" ,
> > $output ) ;
> >
> > I need to replace $var with $GLOBALS['var'], however the regexp above
> > doesn't work. What am I doing wrong?
>
>$output = preg_replace( "/\$(\w+)/e" , "\$GLOBALS['\\1']" ,
>$output ) ;
>
>-Andrei
>* George Orwell was an optimist. *
>
>--
>PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
>To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
>For additional commands, e-mail: php4beta-help@lists.php.net
>To contact the list administrators, e-mail: php4beta-admin@lists.php.net
------end of quote------
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
cynic@mail.cz
ICQ: 2808 2505