I am new in PHP
I want to remove last comma of a string, how can i do that.
Here is my code :
<?php
$sub ="economic,maths,science";
$cap = explode(",",$sub);
foreach($cap as $new){
echo ucfirst($new).",";
}
?>
any help would be greatly appreciated, thanks in advance.
1 Answer