In c++ there is function : http://www.cplusplus.com/reference/string/string/find_first_not_of/
Searches the string for the first character that does not match any of the characters specified in its arguments.
std::size_t found = str.find_first_not_of("abcdefghijklmnopqrstuvwxyz ");
Is there something like this in php ?