php check if string contains a char
snippet in php

php find if substring is in string

user2129

$result = strpos("haystack", "needle");

if ($result != false)
{
  // text found
}

if text contains word then in php

user2893

if (strpos($haystack,$needle) !== false) {
    echo "$haystack contains $needle";
}

php check if string contains a char

user3919

$haystack = 'This is my haystack that we shall check'
$has_A = strpos($haystack, 'A') !== false;
$has_a = strpos($haystack, 'a') !== false;