PHP Remove Last Comma from String Example
Hi Dev,
In this tutorial, I will show you php remove last comma from string example. step by step explain remove last comma from string php example. this example will help you how to remove last comma from string?. This article goes in detailed on how do i remove the last comma from a string using php?.
There are example to remove Last Comma from strings in PHP. in this example, we will use to rtrim() function used to remove Last Comma. so Let's see the following example with output.
Example: Remove Last Comma
index.php
<?php
$string = "Hello, Developers,";
//Remove Last Comma from string
$result = rtrim($string, ',');
echo $result;
?>
Output:
Hello, Developers
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