Skip to content

Instantly share code, notes, and snippets.

@mikedugan
Created November 7, 2013 14:51
Show Gist options
  • Select an option

  • Save mikedugan/7355849 to your computer and use it in GitHub Desktop.

Select an option

Save mikedugan/7355849 to your computer and use it in GitHub Desktop.
produces readable array
<?php
function readableArray($elements, $delimiter = ', ', $finalDelimiter = ' and ') {
$lastElement = array_pop($elements);
return join($delimiter, $elements) . $finalDelimiter . $lastElement;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment