Skip to content

Instantly share code, notes, and snippets.

@luckyshot
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luckyshot/a583e93e81db3aae3351 to your computer and use it in GitHub Desktop.
Save luckyshot/a583e93e81db3aae3351 to your computer and use it in GitHub Desktop.
Enumerate list with commas and the last one with "and"
<?php
$array = (1,2,3);
$last = array_pop($array);
echo strtolower(implode(', ', $array)." and ".$last);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment