Re: need to change $ char in string

From: Date: Sat, 29 Jun 2002 19:30:41 +0000
Subject: Re: need to change $ char in string
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-104521@lists.php.net to get a copy of this message
works for me on win2k ----- Original Message ----- From: "Jason Wong" <php-general@gremlins.com.hk> To: <php-general@lists.php.net> Sent: Saturday, June 29, 2002 6:43 PM Subject: Re: [PHP] need to change $ char in string On Sunday 30 June 2002 01:24, Beverly Steiner wrote: > Thanx for your suggestion but I tried it and it didn't work. I'm not sure > if it matters, but this running on NT. Not sure whether NT has anything to do with it but it works for me :-) If you can't get the following code to work then you might want to check whether it is a known bug (http://bugs.php.net). <? $test_string = '1.2$General/ms1.zip'; $new_string = preg_replace("/\\$/", "%", $test_string); echo "new_string is $new_string"; ?> But as someone has pointed out, you should be using single-quotes to prevent unwanted/unexpected variable expansion: $new_string = preg_replace('/\$/', '%', $test_string); -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* All great discoveries are made by mistake. -- Young */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#104521) next »