Re: Unwanted Characters

From: Date: Sun, 25 Feb 2001 15:17:48 +0000
Subject: Re: Unwanted Characters
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-41589@lists.php.net to get a copy of this message
This doesn't seem to work, have I done something wrong? $sometext = "ThÀe cØar röøan over mÖy dog\n"; $thread = ereg_replace("[^[:alnum:][:space:]]", "", $sometext); echo $thread; still prints: ThÀe cØar röøan over mÖy dog Thanks, Clayton ----- Original Message ----- From: <mwaples@waples.net> To: "Clayton Dukes" <cdukes@cdukes.com> Sent: Sunday, February 25, 2001 2:28 AM Subject: Re: [PHP] Unwanted Characters > Clayton Dukes wrote: > > > > How do I remove unwanted/unprintable characters from a variable? > > > > $sometext = "ThÀe cØar röøan over mÖy dog" > > needs to be filtered and reprinted as: > > "The car ran over my dog" > > > > Thanks :-) > > Clayton Dukes > > <?php > $sometext = "ThÀe cØar röøan over mÖy dog"; > $thread = ereg_replace("[^[:alnum:][:space:]]", "", $sometext); > echo $thread > ?> > > will print what you asked - of course you may not want numbers but you > get the idea. > I do this check on all my user inputs to php scripts- I choose what is > allowed not what to deny which makes it easier. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#41589) next »