Or do it all in one line:

        $string = ereg_replace('[!@#$%^&*()_+=-';:"/.,<>?]', '', $string);

If you want to remove non-alphanumeric characters from a string, you can do:

        $string = ereg_replace('[^[:alnum:]]', '', $string);

Perl-compatible regular expressions would work as well, and be 
slightly faster. For more info, see:

        http://www.php.net/manual/en/function.ereg.php
        http://www.php.net/manual/en/ref.regex.php
        http://www.php.net/manual/en/ref.pcre.php

-steve


At 12:21 PM -0800 1/26/02, "qartis" <[EMAIL PROTECTED]> wrote:
>I'm guessing something along the lines of:
>
>--
>$string=str_replace("!","",$string);
>$string=str_replace("@","",$string);
>$string=str_replace("#","",$string);
>$string=str_replace("$","",$string);
>$string=str_replace("%","",$string);
>$string=str_replace("^","",$string);
>--
>
>etc.
>
>"Philip J. Newman" <[EMAIL PROTECTED]> wrote in message
>003d01c1a6a5$fa7d60e0$0401a8c0@philip">news:003d01c1a6a5$fa7d60e0$0401a8c0@philip...
>Any Ideas how I can remove   !@#$%^&*()_+=-';:"/.,<>? charactors from a
>string?
>
>Philip J. Newman
>Philip's Domain - Internet Project.
>http://www.philipsdomain.com/
>[EMAIL PROTECTED]
>Phone: +64 25 6144012


-- 
+------------------------------------------------------------------------+
| Steve Edberg                                      [EMAIL PROTECTED] |
| University of California, Davis                          (530)754-9127 |
| Programming/Database/SysAdmin               http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| "Restriction of free thought and free speech is the most dangerous of  |
| all subversions. It is the one un-American act that could most easily  |
| defeat us."                                                            |
|                 - Supreme Court Justice (1939-1975) William O. Douglas |
+------------------------------------------------------------------------+

-- 
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]

Reply via email to