KillerBean Posted August 18, 2006 Report Share Posted August 18, 2006 Sveiki. Gribeeju pajautaat - ar kaadu funkciju var masiiva veertiibas, pirms atteelo, sakaartot pieaugoshaa/dilstoshaa seciibaa (masiiva veertiiba vienmeer buus skaitlis). Ar foreach vinjsh vnk vinjas peec kaartas atteelo. Un tad veel 1. tas bish par HTML. kaa <input type='text'> var noraadiit, lai var ierakstiit tikai skaitljus. (ja taa var.) Paldies. Link to comment Share on other sites More sharing options...
AcidRain Posted August 18, 2006 Report Share Posted August 18, 2006 To var izdarīt ar: sort(). Link to comment Share on other sites More sharing options...
andrisp Posted August 18, 2006 Report Share Posted August 18, 2006 Un tad veel 1. tas bish par HTML. kaa <input type='text'> var noraadiit, lai var ierakstiit tikai skaitljus. (ja taa var.) Iekš HTML tā nevar, jāizmanto Javascript. Link to comment Share on other sites More sharing options...
KillerBean Posted August 18, 2006 Author Report Share Posted August 18, 2006 Nu ar: sort($array, SORT_NUMERIC); vinjsh ne taa sashkjiro. Piemeeram. 2; 3; 4; 22 vietaa vinjsh to atteelo -> 2; 22; 3; 4 Link to comment Share on other sites More sharing options...
Blitz Posted August 18, 2006 Report Share Posted August 18, 2006 tad natsort() Link to comment Share on other sites More sharing options...
KillerBean Posted August 18, 2006 Author Report Share Posted August 18, 2006 uff. atradu 1 kljuudu. bet tas buutiibu nemaina. man ir Multi-array ($array[0][0]...) un tapeec vinjsh kkaa arii ar natsort negrib sapludinaat visas veertiibas.. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted August 18, 2006 Report Share Posted August 18, 2006 roc peec shiim... -------- uasort -- Sort an array with a user-defined comparison function and maintain index association uksort -- Sort an array by keys using a user-defined comparison function usort -- Sort an array by values using a user-defined comparison function --------------- Link to comment Share on other sites More sharing options...
Kristabs Posted August 18, 2006 Report Share Posted August 18, 2006 Vēl tāda piebilde, ka ja izmanto templeitus, piemēram, un masīvus veido lasot vērtibās no db, lai vēlāk attēlotu, tad uzreiz pieprasot no db izmanto order by and blaa blaa. Pēc tam arī ar foreach būs viss pareizajā secībā. Link to comment Share on other sites More sharing options...
andrisp Posted August 18, 2006 Report Share Posted August 18, 2006 Tā jādara jau jebkurā gadijumā; arī ja neizmanto templeitus. Link to comment Share on other sites More sharing options...
Recommended Posts