blackhalt Posted January 26, 2004 Report Share Posted January 26, 2004 ir dati.txt [utf-8] satur: 1|Bānis| 2|Ābrams| 3|Anna| 4|Cukurs| php izdrukā: visu pēc kārtas ar explode un nolasa faila line Bānis = 1 Ābrams = 2 Anna = 3 Cukurs = 4 Kā lai šito padarīšanu izdrukā šādi [Alfabēta kārtībā], ja nedrīkst mainīt ieraksta atrašanās vietu faila līnijās? dati.txt jāpaliek tādam pašam, bet izdrukāt vajag: Anna = 3 Ābrams = 2 Bānis = 1 Cukurs = 4 :ph34r: Link to comment Share on other sites More sharing options...
рпр Posted January 26, 2004 Report Share Posted January 26, 2004 ielasi to visu kaa masiivu un izmanto asort Link to comment Share on other sites More sharing options...
blackhalt Posted January 27, 2004 Author Report Share Posted January 27, 2004 Atrisināju savādāk, bet nu ja kas paliek spēkā kaa nenojaucot liinijas sazorteet ? ;) Link to comment Share on other sites More sharing options...
Venom Posted January 28, 2004 Report Share Posted January 28, 2004 $data=array_flip($data); arsort($data); ? Link to comment Share on other sites More sharing options...
jb4 Posted January 28, 2004 Report Share Posted January 28, 2004 array_flip() + asort() === ksort() Link to comment Share on other sites More sharing options...
Recommended Posts