- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Remove comma from a string in PHP?
To remove comma, you can replace. To replace, use str_replace() in PHP.
Let’s say the following is our input string with comma
We want the output after removing comma from the above string is
The PHP code is as follows
<!DOCTYPE html> <html> <body> <?php $name="John,Smith"; $result = str_replace(',', '', $name); echo "The actual value is=",$name,"<br>"; echo "After removing the comma(,)=",$result,"<br>"; ?> </body> </html>
This will produce the following output
The actual value is=John,Smith After removing the comma(,)=JohnSmith
- Remove new lines from string in PHP
- Remove specific word in a comma separated string with MySQL
- Stripping last comma from a foreach loop in PHP?
- PHP program to remove non-alphanumeric characters from string
- PHP: Remove object from array
- How to create a comma separated string from a list of string in C#?
- Remove vowels from a String in C++
- Remove Vowels from a String in Python
- MySQL Query to remove all characters after last comma in string?
- Remove new lines from a string and replace with one empty space PHP?
- Remove Leading Zeros from a String in C#
- How would you make a comma-separated string from a list in Python?
- How to create comma separated list from an array in PHP?
- What is Trailing Comma in PHP?