What are some alternative methods to using regular expressions for simple string searches in PHP?

Regular expressions can be complex and difficult to read, especially for simple string searches. An alternative method is to use the strpos() function in PHP, which searches for the occurrence of a substring within a string. This function is simpler and more intuitive for basic string searches.

// Using strpos() for simple string search
$string = "Hello, World!";
$search = "World";

if (strpos($string, $search) !== false) {
    echo "Found '$search' in '$string'";
} else {
    echo "Did not find '$search' in '$string'";
}