Code Comments
Programming Forum and web based access to our favorite programming groups.Hi,
Thanks for looking/anwsering my question.
Implode seems to implode on the 'sequence' of the inputed information, not
on the array index. Is there a short command for doing that ?
For example:
$test[0]=0;
$test[1]=1;
$test[2]=2;
$test[6]=6;
$test[3]=3;
$test[4]=4;
$test[5]=5;
echo implode(",", $test);
will return 0,1,2,6,3,4,5
while I want 0,1,2,3,4,5,6
I can solve this by making a 'fake' new array and implode that, but that
doesn't look nice code to me.
for ($i=0;$i<6;$i++)
$test_sorted[$i] = $test[$i];
echo implode(",", $test_sorted);
will now return 0,1,2,3,4,5,6
Thanks in advanced,
Niels Laurens
Post Follow-up to this messageNiels Laurens a écrit le 26/03/2004 :
> echo implode(",", $test);
> will return 0,1,2,6,3,4,5
>
> while I want 0,1,2,3,4,5,6
Use sort($test); before the implode();
Post Follow-up to this messageThanks :) "Jedi121" <jedi121news@free.fr.Removethis> wrote in message news:mesnews.d55a7d43.55a599ed.627.2689@free.fr.Removethis... > Niels Laurens a écrit le 26/03/2004 : > > Use sort($test); before the implode(); > >
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.