Sunday, 25 August 2013

PHP Function eregi_replace()

Syntax

string eregi_replace (string pattern, string replacement, string originalstring);

Definition and Usage

The eregi_replace() function operates exactly like ereg_replace(), except that the search for pattern in string is not case sensitive.

Return Value

  • After the replacement has occurred, the modified string will be returned.
  • If no matches are found, the string will remain unchanged.

Example

Following is the piece of code, copy and paste this code into a file and verify the result.
<?php

$copy_date = "Copyright 2000";
$copy_date = eregi_replace("([a-z]+)", "&Copy;", $copy_date);
print $copy_date;

?>
This will produce following result
© 2000

No comments:

Post a Comment