function arrayToLabel($array, $type) { $labels = array(); $amparsand = false; //if & in label, add line feeds forEach(array_keys($array) as $key) { $label = $this->toLabel($array[$key], $type); $labels[] = $label; if (strPos($label, '&') !== false) $amparsand = true; } $sep = $amparsand ? "$this->labelItemSeparator\n" : $this->labelItemSeparator; return implode($sep, $labels); } |