What are some alternative functions to strpos() that could be used for similar purposes in PHP code?

When searching for a substring within a string in PHP, strpos() is commonly used. However, there are alternative functions that can achieve similar results, such as strstr(), preg_match(), and substr(). These functions can be used depending on the specific requirements of the search operation.

// Using strstr() function as an alternative to strpos()
$haystack = 'Hello, world!';
$needle = 'world';
$result = strstr($haystack, $needle);

if($result !== false) {
    echo "Needle found in haystack: " . $result;
} else {
    echo "Needle not found in haystack";
}