03-Apr-2023
.
Admin
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...
#PHP