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

Home » Imported messages » comp.lang.php » implode() order?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: implode() order? [message #176306 is a reply to message #176298] Tue, 20 December 2011 01:55 Go to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
Mike wrote:

> Thanks... suppose the keys are not in a sortable order, like this:
>
> $toImplode = Array(
> "second" = "Second",
> "fourth" = "Fourth",
> "third" = "Third",
> "first" = "First"
> );

This is not PHP code.

> Or would I need to simply:
>
> echo $toImplode["first"] . $toImplode["second"]; // etc.

No, aside from u(k)sort() you can use a loop to build a new array:

$a = array();

foreach (array('first', 'second', 'third', 'fourth') as $key)
{
$a[] = $toImplode[$key];
}

echo implode(',', $a);


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(at)news(dot)demon(dot)co(dot)uk>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: implode() order?
Next Topic: FastCGI + ignore_user_abort
Goto Forum:
  

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

Current Time: Sat Nov 23 02:30:44 GMT 2024

Total time taken to generate the page: 0.15023 seconds