How to remove "," at the end of text in php?

I have a text:

"2G Network":"GSM 850","3G Network":"HSDPA 850",

How to remove "," at the end of text in php

"2G Network":"GSM 850","3G Network":"HSDPA 850"
+5
source share
2 answers

Use rtrim()

$str = rtrim($str, ',');
+13
source

Substr () is your friend.

$noComma = substr('"2G Network":"GSM 850","3G Network":"HSDPA 850",', 0, -1);
0
source

All Articles