Home Answers Viewqa PHP What is the difference between ereg_replace() and eregi_replace()?

 
 


brijesh
What is the difference between ereg_replace() and eregi_replace()?
1 Answer(s)      2 years and 6 months ago
Posted in : PHP

What is the difference between eregreplace() and eregireplace()?

View Answers

November 15, 2010 at 11:51 AM


Hi all,

In PHP,

ereg_replace ? Replace regular expression case sensitive.

eregi_replace ? Replace regular expression case insensitive.

Example of ereg_replace :

<?php
$lastname = 'Kumar';
$string = "This is deepak singh.";
$string = ereg_replace('singh', $lastname, $string);
echo $string;   /* Output: 'This is deepak kumar.' */
?>

Example of eregi_replace :

<?php

$string = "Hi this is deepak.";

print "Output :" .
   eregi_replace("DEEPAK", "Kumar", $string);
/* Output: 'Hi this is Kumar.' */
?>

eregireplace() is case insensitive, while eregreplace() is not.

Thanks









Related Pages:

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.