• Have Any Question?
  • contact@eitworld.com

PHP string_replace()Function





  • The PHP str_replace() function replaces some characters with some other characters in a string.
  • The given example shows the use of PHP str_replace() function:

<!DOCTYPE html>

<html>

<body>

<?php

echo str_replace("eitworld", "world","www.eitworld.com");

echo "<br>";

echo str_replace("Tutorial", "Books","Popular Tutorial");

echo "<br>";

echo str_replace("PHP, "HTML","PHP Tutorial");

?>

</body>

</html>

Output

string

    In the above example:

  • str_replace function replaces the eitworld with world in first string www.eitworld.com .
  • str_replace function replaces the Tutorial with Books in Second string Popular Tutorial.
  • str_replace function replaces the PHP with HTML in Third string PHP Tutorial.


Real Time Web Analytics