Are there alternative functions in PHP that can help PHP developers achieve the desired outcome when searching for substrings within strings?

When searching for substrings within strings in PHP, developers commonly use the `strpos()` function to find the position of the first occurrence of a substring within a string. However, if the desired outcome is to find all occurrences of a substring within a string, the `preg_match_all()` function can be used with a regular expression pattern to achieve this.

$string = "The quick brown fox jumps over the lazy dog";
$substring = "the";
$pattern = "/$substring/i"; // Case-insensitive pattern

if (preg_match_all($pattern, $string, $matches)) {
    echo "Found " . count($matches[0]) . " occurrences of '$substring' in the string.";
} else {
    echo "No occurrences of '$substring' found in the string.";
}