Implode an array without first element
Use array_shift
followed by implode
.
$array = YOUR_ORIGINAL_ARRAY;
$cname = array_shift($array);
$string = implode(',', $array);
Try the following:
$removedElementValue = array_shift($yourArray);
$implodedArray = implode(',', $yourArray);
Just copy the array, then delete the cname
property before calling implode
.
$copy = $arr;
unset($copy['cname']);
implode($copy);
This works because in PHP, array assignment copies. (Sort of bizarre, but it works.)