What are some common pitfalls when using in_array to search for specific characters in PHP?

When using in_array to search for specific characters in PHP, one common pitfall is that it only works with arrays of values, not strings. To search for specific characters in a string, you can use functions like strpos or strstr instead.

// Incorrect usage of in_array to search for specific characters in a string
$string = "hello";
$char = "e";
if (in_array($char, $string)) {
    echo "Character found in string";
} else {
    echo "Character not found in string";
}

// Correct way to search for specific characters in a string using strpos
$string = "hello";
$char = "e";
if (strpos($string, $char) !== false) {
    echo "Character found in string";
} else {
    echo "Character not found in string";
}