03-Apr-2023
.
Admin
Hi Dev,
Hello all! In this article, we will talk about How to string replace comma with space in PHP. This post will give you simple example of comma with space replace in PHP example. it's simple example of Replace comma with space for specified field in record. you'll learn Program to replace comma with space in list in PHP.
Example 1
index.php
<?php
echo substr_replace("Hello","world",0); // 0 will start replacing at the first character in the string
?>
Output:
world
Example 2
index.php
<?php
$stringBefore="pqr,stu,vwx";
$stringAfter = str_replace(",", "-",$stringBefore);
print $stringAfter;
?>
Output:
pqr-stu-vwx
I hope it could help you...
#PHP