string str replace function - replaces the search string with the replacement string

string str_replace function - replaces the search string with the replacement string

string-str-replace-function-in-php.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>string str_replace function - replaces the search string with the replacement string</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="Author" content="Md Iqbal Hosan">
  <meta name="title" content="string str_replace function - replaces the search string with the replacement string">
  <meta name="keywords" content="php, example, code, array, function, str_replace, string">
  <meta name="description" content="string str_replace function - replaces the search string with the replacement string">
  <style>
   h2, h4{background:#bbb; color:#000082;}
   h2{ padding:3px; margin:3px; font-size:22px;}
   h4{ padding:2px; margin:2px; font-size:18px;}
   p{padding:2px; margin:2px; color:#0099fe;}
   body{ background:#FFFFFa;}
  </style>
 </head>
 <body>
  <h2>string str_replace function - replaces the search string with the replacement string</h2>
  <pre>
   <?php
    /*
     -----------------------------
     let us make a simple string
     -----------------------------
    */
    $myString = "my seo seo seo seo seo seo boss is cfsuman";
    echo "<h4>Output of myString String</h4>";
    print "<p>$"."myString = {$myString}</p>";
    print "<p>string length : ".strlen($myString)."</p>";
    /*
     -----------------------------------------------------------------------------------
     now i want to replace all seo with whitespace by using str_replace string function
     -----------------------------------------------------------------------------------
    */
    $myReplacedString = str_replace("seo", "", $myString);
    echo "<h4>Output of myReplacedString by using string str_replace function</h4>";
    print "<p>$"."myReplacedString = {$myReplacedString}</p>";
    print "<p>string length : ".strlen($myReplacedString)."</p>";
    /*
     ---------------------------------------------------------------------------------------------
     this function rapidly used in professional programming to replace unwanted data from visitos
     ---------------------------------------------------------------------------------------------
    */
   ?>
  </pre>
 </body>
</html>

string str_replace function - replaces the search string with the replacement string - output in the browser

No comments:

Post a Comment

leave your comments here..