printing comma-delimited lists

From: Date: Thu, 04 Oct 2001 14:09:46 +0000
Subject: printing comma-delimited lists
Groups: php.general 
Request: Send a blank email to php-general+get-69919@lists.php.net to get a copy of this message
What I'm doing here is fairly obvious (build a comma-delimited string). $arr = array(1,2,3,4,5); for ($i=0; $i< sizeof($arr); $i++) { $lis = $lis . $arr[$i]; if ($i != (sizeof($arr)-1)) { $lis = $lis . ','; } } Question is, is there a more elegant way? I'm thinking of something like DTML's sequence-start and sequence-end, in a foreach construction. djo

« previous php.general (#69919) next »