Re: Escaping '#' Sign

From: Date: Wed, 11 Dec 2002 23:56:50 +0000
Subject: Re: Escaping '#' Sign
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-127928@lists.php.net to get a copy of this message
Why don't you just try: $cust2 = str_replace('#','#',$cust); That should replace all instances of # with it's html entity equivalent. If that doesn¹t work then there is something else wrong with your script and we'll need to see it all! :) Rick "People who drink to drown their sorrow should be told that sorrow knows how to swim." - Ann Landers > I have a string I'm returning from a database. Some entries have # signs > in the names ie (COMPANY #42, COMPANY #43...). When I display results > all I have is COMPANY. Everything after the # is dropped off. I tried: > > If ($cust) { > $cust2=ereg_replace('#','no',$cust); > //tried $cust2=ereg_replace("#","no",$cust); too > } > > but that still returns the same thing (COMPANY). > > Also tried: > > $cust2 = preg_replace ("'&(pound|#163);'i", chr(163), $cust); > > Any help is appreciated. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

« previous php.general (#127928) next »