What alternative PHP function could be used instead of in_array() to check for the presence of a substring within a string?

The issue with using in_array() to check for the presence of a substring within a string is that it is designed to check for the presence of an exact value in an array, not a substring within a string. To solve this issue, you can use the strpos() function in PHP, which searches for the first occurrence of a substring within a string and returns the position of the substring if found.

$string = "Hello, World!";
$substring = "Hello";

if (strpos($string, $substring) !== false) {
    echo "Substring found in the string.";
} else {
    echo "Substring not found in the string.";
}