I tried to get rid of the last comma out of my result from a for loop, but rtrim gets rid of all commas, not only the last one.
This is what I tried
$myCoinsCoinReader = array_keys($myCoins);
for ($i = 0; $i < sizeof($myCoins); $i++) {
$coinReader = $myCoinsCoinReader[$i] . ',';
$resultReader = rtrim($coinReader, ",");
echo $resultReader;
};
The Result of $coinReader is BTC,ETH,
The Result of $resultReader is BTCETH (all commas gone)
What can I do to only get rid of the last comma?
Thanks in advance