Re: strtoupper in eregi_replace

From: Date: Thu, 22 Jul 1999 12:32:50 +0000
Subject: Re: strtoupper in eregi_replace
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-8959@lists.php.net to get a copy of this message
Think order of evaluation. You are actually doing strtoupper() on the string "\\1", not on the match result. Do to what you want, you need a regexp function that can evaluate the result for you. preg_replace() in the latest 4.0 CVS can do that with the "e" modifier. - Stig On Thu, 22 Jul 1999, Michael Schueller wrote: > Hi, > > I tried to replace a string by his uppercase-expression, like > > $val = "abcde"; > $val = eregi_replace("a(.*)e", strtoupper("\\1"), $val); > > but it didn't work. > Output should be "BCD", but was "bcd". > What's wrong? > > Regards, > Michael > > (PHP 3.0.7, LINUX RedHat 5.1, Kernel 2.0.34) > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.dev (#8959) next »