[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] PHP: ændre rækkefølgen på et associativt array



On Tue, 24 Oct 2006 10:28:52 +0200, Lars Riisgaard Ribe wrote:


> Det er faktisk ikke rigtigt. I PHP vil f.eks. en foreach-løkke vise dem
> i den rækkefølge, de er blevet tilføjet array'et i - ikke sorteret efter
> deres nøgle (hvilket ville være det mest naturlige...)
> 
Hvad har det med spørgsmålet at gøre? Foreach er læsning, og spørgsmålet
omhandlede skrivning

> Men for at svare på Peters spørgsmål: Den eneste måde, jeg har kunne
> finde ud af at ændre i rækkefølgen, er ved: 1) Lave et nyt array hvor du
> sætter dem i den rækkefølge, du vil have dem ud på. 2) Hvis det bare er
> nogle få elementer, du vil have tilsidst, kan du bruge $tmp =
> $ditarray['dinnøgle]; unset($ditarray['dinnøgle]); $ditarray['dinnøgle']
> = $tmp;
> 
Så det vil du gøre hver gang, du skal udskrive!? $ditarray['dinnøgle']:
Denne notation siger intet om hvor i array'et, at elementet bliver indsat.

-- 
Hilsen/Regards
Michael Rasmussen
http://keyserver.veridis.com:11371/pks/lookup?op=get&search=0xE3E80917


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-11-01, 02:01 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *