Remove last comma from string in php

$string = "Bar, Restaurant, Take Away Food, Dive School, Hotel,";
rtrim($string, ",");
or 
You can use substr($string, 0, -1);

Comments

Popular posts from this blog

Stop video playing when Bootstrap modal is closed