How I can check if some string contains forward slash in PHP?
Check for occurences with strpos()
if (strpos($string, '/') !== FALSE) // Found
Returns the position as an integer. If needle is not found, strpos() will return boolean FALSE.
This is faster than a regular expression, and most other methods, because it stops checking at the first occurrence.
It is very simple:
preg_match ('~/~', $string);