Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


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


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


Advertisement
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 Tutorials/Questions & Answers:
 

 

 

DMCA.com