goma smile Posted September 21, 2015 Report Share Posted September 21, 2015 (edited) Sveiki, vai nevarētu man palīdzēt.. tā tad ir masīvs kas gala rezultātā uzģenerējās +- kāds ir lejā. Ka var sortēt masīvu pēc Rates vērtības... proti ja rates ir mazāks viņš ir augstāk.. Un ir vēl variants ka vairāki rate ir uz vienas "Economy|Executive|Standard|" un arī viņus attiecīgi no kreisās uz labo.. Array ( [Economy] => Array ( [shuttledirect] => Array ( [0] => Array ( [Rates] => 382.46 ) ) ) [Executive] => Array ( [shuttledirect] => Array ( [0] => Array ( [Rates] => 567.11 ) ) ) [Standard] => Array ( [foxtransfer] => Array ( [0] => Array ( [Rates] => 289.00 ) ) ) ) Edited September 21, 2015 by goma smile Quote Link to comment Share on other sites More sharing options...
Kavacky Posted September 22, 2015 Report Share Posted September 22, 2015 usort? Quote Link to comment Share on other sites More sharing options...
goma smile Posted September 23, 2015 Author Report Share Posted September 23, 2015 (edited) var lūdzu mazu piemēru ka ar to usort tu vari vairaku dimensiju masīvā kko sortēt ? function sortArray($a, $b){ return ($a['Rates'] < $b['Rates']) ? -1 : 1; } usort($array, 'sortArray'); Uz to Rates var tik ar Foreach palīdzību.. ? Edited September 23, 2015 by goma smile Quote Link to comment Share on other sites More sharing options...
goma smile Posted September 24, 2015 Author Report Share Posted September 24, 2015 Hah, vakar ilgi domāju šodien pa 10 min uzrakstiju... Nezinu vai pareizi vai ne... Sākumā uztaisiju 2 dimensiju masīvu tad usort un tad atpakaļ uz 'Lielo'... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.