RE: [PHP-DB] Sorting Arrays
| From: | Rich Gray | Date: | Tue, 28 Jan 2003 09:41:50 +0000 |
| Subject: | RE: [PHP-DB] Sorting Arrays | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-25197@lists.php.net to get a copy of this message | ||
Mark
Not exactly sure what you're after but will array_multisort() help?
http://www.php.net/array_multisort
Rich
-----Original Message-----
From: Mark @ Webbiz NZ [mailto:mark@webbiznz.net.nz]
Sent: 28 January 2003 05:10
To: php-db@lists.php.net
Subject: [PHP-DB] Sorting Arrays
Hello,
I don't understand arrays that well. If someone can help me sort the
contents it would be appreciated.
I have data being retrieved from a text file and the fields as an array
inserted into another array.
orderby is numeric is 1-99 and requires sorting ASC
content is just formatted html
for instance :
While Loop
$a++
Get Data content & orderby
$marray[$a] = Array("content"=>$msort , "orderby"=>$orderby[1]);
End
After this data is retrieved I would like to sort the information by the
orderby field.
Then the information is printed from the content field as per the sorted
order
foreach ($marray as $val) {
echo $val['content'];
}
If someone can help me out, this would be appreciated.
Regards
Mark
NZ