function concatenate($elements, $delimiter = ', ', $finalDelimiter = ' and ') ( $lastElement = array_pop($elements); return join($delimiter, $elements) . $finalDelimiter . $lastElement; )
Bruk
$array = array('John', 'Mary', 'Ishmal'); echo concatenate($array); // outputs "John, Mary and Ishmal"
Gi den andre parameteren, en streng, for en annen skilletegn enn et komma.