What is the purpose of using eregi_replace in PHP?

The eregi_replace function in PHP is used to perform a case-insensitive regular expression search and replace within a string. This can be useful when you want to replace certain patterns in a string regardless of their case.

// Example of using eregi_replace to replace a pattern in a string
$string = "Hello World";
$newString = eregi_replace("hello", "hi", $string);
echo $newString; // Output: "hi World"