Php – Removing specific characters from a string in php


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

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


Best Solution

use the function strstr Returns part of haystack string from the first occurrence of needle to the end of haystack

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