30 seconds of PHP

  Back to Home

isContains

stringbeginner

Check if a word / substring exists in a given string input.

Using strpos() to find the position of the first occurrence of a substring in a string.

function isContains($string, $needle)
{
  return strpos($string, $needle) === false ? false : true;
}