Implode an array without first element Implode an array without first element arrays arrays

Implode an array without first element


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.)


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);