Forum Moderators: coopster
Four examples:
Joe, John, Jim and Jane Fred, Frank and Flo Sally and Sarah Daniel
Maybe I could use some sort of regex on an imploded string?
A working example would be greatly appreciated.
[edited by: httpwebwitch at 1:04 am (utc) on Aug. 30, 2004]
function fancy_join($list, $glue=', ', $final_glue=' and ') { if (count($list)) == 0) return null; if (count($list)) == 1) return $list[0]; $last = array_pop($list); return implode($glue, $list) . $final_glue . $last; }