Categories
PHP

eregi_replace() vs. ereg_replace()

Code:

<?php

$s = “Coding PHP is fun.”;

print “ereg_replace(): ” .
ereg_replace(“CODING”, “Learning”, $s) . “<br>”;
print “eregi_replace(): ” .
eregi_replace(“CODING”, “Learning”, $s);

?>

Output:

ereg_replace(): Coding PHP is fun.
eregi_replace(): Learning PHP is fun.
Explanation:

eregi_replace() is case insensitive, while ereg_replace() is not.