MySQL Forums
Forum List  »  PHP

Re: while loop - how to remove last comma
Posted by: Rick James
Date: December 03, 2012 07:49PM

I find this pattern to be shorter:
$list = array();
while (...) { 
    $list[] = "<...>";
}
echo implode(', ', $list);

Options: ReplyQuote


Subject
Written By
Posted
Re: while loop - how to remove last comma
December 03, 2012 07:49PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.