Re: [PHP] sorting multi-dimensional arrays

2004-01-16 Thread Mike Migurski
>I've read the manual several times on sorting multi-dimensional arrays, >but I can't seem to wrap my mind around what I need to do to accomplish >my goal. > >//this is what I'm doing: (stepping through a result set, and putting it >into a multi-dimensional array. > >while ($row = mysql_fetch_array

[PHP] sorting multi-dimensional arrays

2004-01-16 Thread Katie Dewees
Hi All, I've read the manual several times on sorting multi-dimensional arrays, but I can't seem to wrap my mind around what I need to do to accomplish my goal. //this is what I'm doing: (stepping through a result set, and putting it into a multi-dimensional array. while ($row = mysql_fetch_arra

RE: [PHP] sorting multi-dimensional arrays

2003-12-22 Thread Phil Ewington - 43 Plc
Ooops, forgot to specify the compare function with usort(); all working now. Phil. -Original Message- From: Phil Ewington - 43 Plc [mailto:[EMAIL PROTECTED] Sent: 22 December 2003 14:08 To: [EMAIL PROTECTED] Subject: [PHP] sorting multi-dimensional arrays Hi All, I am trying to sort

[PHP] sorting multi-dimensional arrays

2003-12-22 Thread Phil Ewington - 43 Plc
Hi All, I am trying to sort a multi-dimensional array using a value in the second dimension. I have looked at the usort examples but don't fully understand what usort is actually doing so am struggling. I have tried the following: if (! getmxrr($this->_Domain, $as_hosts, $ai_weights)) { r

RE: [PHP] Sorting Multi-Dimensional Arrays using uksort()

2002-04-01 Thread Bloom, Chris
Sweet! Thanks for the help! -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Monday, April 01, 2002 7:15 PM To: 'Bloom, Chris'; '[EMAIL PROTECTED]' Subject: RE: [PHP] Sorting Multi-Dimensional Arrays using uksort() try using usort() inst

RE: [PHP] Sorting Multi-Dimensional Arrays using uksort()

2002-04-01 Thread Martin Towell
9:57 AM To: '[EMAIL PROTECTED]' Cc: Bloom, Chris Subject: [PHP] Sorting Multi-Dimensional Arrays using uksort() Hey folks: I have a function that returns an array. I'm assigning the returned array to a variable inside another function: -- $dirs = getFileArra

[PHP] Sorting Multi-Dimensional Arrays using uksort()

2002-04-01 Thread Bloom, Chris
Hey folks: I have a function that returns an array. I'm assigning the returned array to a variable inside another function: -- $dirs = getFileArray($parentDir,"title_2.txt"); -- If I use print_r() on the variable it writes out as expected: -- Array ( [0] => Array

Re: [PHP] sorting multi-dimensional arrays

2001-09-16 Thread Christian Dechery
eb Application Security - www.whitecrown.net >*/ > >- Original Message ----- >From: "Christian Dechery" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Sunday, September 09, 2001 11:51 PM >Subject: [PHP] sorting multi-dimensional arrays > > &g

[PHP] sorting multi-dimensional arrays

2001-09-15 Thread Christian Dechery
I'm having a little trouble sorting mult-dimensional arrays by key... I looked-up the manual and found out that array_multisort() thing... but I don't think it does what I want... or I don't understand it... I have an array like this... $categories=array(); $categories[0]["id"]=1; $categories[

Re: [PHP] sorting multi-dimensional arrays

2001-04-14 Thread Plutarck
The easiest way is probably to just use a for loop. For instance (no pun intended...well, maybe just a little one): $imax = sizeof($joke); for ($i = 0; $i < $imax; $i++) { if (sizeof($joke[$i]) > 1) { sort($joke[$i]); } } That will handle the sorting of any two-dimensional

Re: [PHP] sorting multi-dimensional arrays

2001-04-14 Thread Delbono
hh, no, maybe the samplecode I posted it's not your case, sorry... > I have a question about sorting multidimensional arrays. Here is my problem: > > I have an 2-d array: > $joke[1][rating]=10; > $joke[2][rating]=20; > $joke[3][rating]=15; > > > I would like to sort the jokes into an

Re: [PHP] sorting multi-dimensional arrays

2001-04-14 Thread Delbono
ails, the following should work: while(list($k, $v) = each($myarray)){ $myarray[$k] = (int) $v; } arsort($myarray); reset($myarray); while(list($k, $v) = each($myarray)){ echo $k, ' == ', $v, "\n; } - Original Message - From: <[EMAIL PROTECTED]> To: &

[PHP] sorting multi-dimensional arrays

2001-04-13 Thread Shane43
I have a question about sorting multidimensional arrays. Here is my problem: I have an 2-d array: $joke[1][rating]=10; $joke[2][rating]=20; $joke[3][rating]=15; I would like to sort the jokes into an array based on the rating from highest to lowest. The end result would be something like t