advanced code snippet search
iloveitaly on 08/31/10
list human formatted
08/31/10 01:44am
1 person have marked this snippet as a favorite
googooster
// ex: human_list(array('one', 'two', 'three)) --> one, two, and threefunction human_list($itemList) { switch(count($itemList)) { case 0: return ''; case 1: return $itemList[0]; default: $last = array_pop($itemList); return implode(', ', $itemList).' and '.$last; }}
Report this snippet Tweet
Comment:
You need to login to post a comment.