FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » comma placement problem
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: comma placement problem [message #181535 is a reply to message #181530] Mon, 20 May 2013 21:05 Go to previous messageGo to previous message
Christoph Becker is currently offline  Christoph Becker
Messages: 91
Registered: June 2012
Karma:
Member
richard wrote:
> This does exactly what I want except that when 1969 is reached, the commas
> don't get placed where I want them.
> I need the commas on every line except for the last line.
> which is why I put the conditional just before the \n.

I usually prefer to build lists, which are *separated* by the same
string, by building a stack (array) of the items and letting the stack
implode() afterwards:

$list = array('One');
$list[] = 'Two';
$list[] = 'Three';
echo implode(', ' $list);

In this particular case I would build up the JSON as nested PHP array,
and then stringify it with json_encode().

--
Christoph M. Becker
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Immediate Position:::Business Analyst With BI EXP::::At Houston, TX
Next Topic: Problem with quotes in javascript output
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 12:39:05 GMT 2024

Total time taken to generate the page: 0.06084 seconds