从PHP中的字符串中删除特定字符

问题描述:

我该如何检查php中的字符串以查找诸如'#'或'\'之类的特定字符?

How can I check a string in php for specific characters such as '#' or '\'?

我真的不想使用replace,只是返回true或false。

I don't really want to use replace, just return true or false.

谢谢

使用该函数strstr http://us2.php.net/manual/en/function.strstr .php
返回从第一次出现针到干草堆结束的部分干草堆字符串

use the function strstr http://us2.php.net/manual/en/function.strstr.php Returns part of haystack string from the first occurrence of needle to the end of haystack

注意:如果您只想确定是否特定的针头发生在干草堆中,请改用速度更快且占用较少内存的函数strpos()。

Note: If you only want to determine if a particular needle occurs within haystack , use the faster and less memory intensive function strpos() instead.