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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]