Answers for "replace the last comma with empty in php"

PHP
4

remove last comma from string php

rtrim($my_string, ',');
Posted by: Guest on November-12-2020
0

last item coma replace and php

$likes = 'Apple, Samsung, Microsoft';
$likes = preg_replace("/,([^,]+)$/", " and $1", $likes)
Posted by: Guest on September-07-2021

Code answers related to "replace the last comma with empty in php"

Browse Popular Code Answers by Language