How to String Replace Comma With Space in PHP?
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...
- How To Use Php Conditional Statement Example
- How to Check if String Contains Regex in PHP?
- PHP Array_column() Function Example
- PHP Generate List of Random Numbers Between 0 and 100 Example
- How to User Login with Facebook in PHP?
- How to Explode Every Character into Array Using PHP Example?
- PHP Form Validation Tutorial
- PHP Convert XML to JSON Example