vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Sorting a multidimensional array... (https://vborg.vbsupport.ru/showthread.php?t=217504)

Jaxel 06-30-2009 01:27 PM

Sorting a multidimensional array...
 
Well I'm back to programming... but I'm having trouble figuring this out... I want to do this with as LITTLE code as possible...

I have an array:
Code:

$id        $arr[$id]['w']        $arr[$id]['l']
Anduril                22        7
Derb                5        24
jimmychoi        25        3
Link-WI                7        21
Lokim                14        14
Mary-dono        5        25
Max                11        17
Metallix        6        24
MysticBill        25        2
Ora                21        8
Outlaw                18        9
Phil Bond        20        8
Pouncer                7        23
Tomi                13        14

Now I want to sort this multidimensional array... It should sort it in the following priority:

['w'] DESC, ['l'] ASC

What that means, it should sort by the highest number of "wins" first, and then break ties by the lowest number of "losses". Does anyone know a simple way to do this?

Andreas 06-30-2009 04:15 PM

<a href="http://de.php.net/manual/en/function.uasort.php" target="_blank">http://de.php.net/manual/en/function.uasort.php</a>


All times are GMT. The time now is 04:11 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01475 seconds
  • Memory Usage 1,707KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete