What is the recommended replacement for the deprecated function eregi() in PHP?

The eregi() function in PHP has been deprecated since PHP 5.3 due to its use of POSIX regular expressions, which are slower and less efficient than the newer PCRE regular expressions. The recommended replacement for eregi() is to use the preg_match() function with the 'i' modifier, which performs a case-insensitive match.

// Deprecated eregi() function
$string = "Hello World";
if (eregi("hello", $string)) {
    echo "Match found!";
}

// Recommended replacement using preg_match()
$string = "Hello World";
if (preg_match("/hello/i", $string)) {
    echo "Match found!";
}