473,320 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Complex array sorting

Hi,

i want to do some sortings to a complex array.
The array structure is at the end of this message

Now I want the result sorted in that way:
SingleRoom ($hotel[0][Rooms][0][max_persons]) - lowest rate ($hotel[0]
[Rooms][0][overall])

or

DoubleRoom - lowest/highest rate
I have no clue how to solve this problem...

can those arrays be sorted with usort??

Regards,
alexander

[0] =Array
(
[Hotel] =Array
(
[id] =9609
[name] =This is a test
[zip] =86154
[created] =2007-11-21 01:04:18
[modified] =2007-11-24 14:18:57
)

[HotelDescriptions] =Array
(
[0] =Array
(
[id] =104691
[descriptiontype_id] =6
[hotel_id] =12345
[description_de] =Test_de
[description_en] =Test_en
[created] =2007-11-25 14:27:34
[modified] =2007-11-25 14:27:37
)

)

[Rooms] =Array
(
[0] =Array
(
[hotel_id] =12345
[room_id] =1234508
[available] =5
[roomtype] =22
[max_persons] =2
[rate_id] =78431
[overall] =168
)

[1] =Array
(
[hotel_id] =12345
[room_id] =1234507
[available] =5
[roomtype] =22
[max_persons] =1
[rate_id] =78431
[overall] =116
)

[2] =Array
(
[hotel_id] =12345
[room_id] =1234505
[available] =5
[roomtype] =14
[max_persons] =1
[rate_id] =78431
[overall] =103
)

[3] =Array
(
[hotel_id] =12345
[room_id] =1234506
[available] =5
[roomtype] =14
[max_persons] =2
[rate_id] =78431
[overall] =148
)
[show] =1
)

)
[1] =Array
(
[Hotel] =Array
(
[id] =9610
[...]

Nov 27 '07 #1
1 1553
yes, usort() should do the trick .
---
http://devoger.blogspot.com
Nov 28 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Kirby | last post by:
Hello All I am trying to update me code to use arrays to store a group of information and I have come up with a problem sorting the multiple array :( Array trying to sort: (7 arrays put into...
11
by: Dr John Stockton | last post by:
Q1 : Given an array such as might have been generated by var A = is there a highly effective way of reducing it to - i.e. removing the undefineds and shifting the rest down? ...
11
by: Laphan | last post by:
Hi All I'm using .getRows() with a local var array instead of doing a recursive loop so that I'm being a good ASP newvbie and closing my object i/o's (the recordset in this case) as quick as...
4
by: John Bullock | last post by:
Hello, I am at wit's end with an array sorting problem. I have a simple table-sorting function which must, at times, sort on columns that include entries with nothing but a space (@nbsp;). I...
3
by: SilverWolf | last post by:
I need some help with sorting and shuffling array of strings. I can't seem to get qsort working, and I don't even know how to start to shuffle the array. Here is what I have for now: #include...
3
by: able | last post by:
Dear friends I have loaded a huge amount of data in an two domensional array. I need to do a lot searching in the array and sorting the array. My question is if an array is the most apropriate...
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
9
by: rkk | last post by:
Hi, I have written a generic mergesort program which is as below: --------------------------------------------------------- mergesort.h ----------------------- void MergeSort(void...
19
by: kawaks40 | last post by:
Hi everyone :) I just recently started using access/sql. and right away I ran into this problem "SQL expression too complex" I google'd a lot on what it means, and the only workaround I've...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.