Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Replace String in PHP

phpCopy<?php
$mystring = "This is my string.";
echo("This is the string before replacement: ");
echo($mystring);
echo("
");
$mynewstring = str_replace(" my ", " ", $mystring, $count);
echo("Now, this is the string after replacement: ");
echo($mynewstring);
echo("
");
echo("The number of replacements is: ");
echo($count);
?>
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #Replace #String #PHP
ADD COMMENT
Topic
Name
5+5 =