Page 1 of 1

Array sorting.

Posted: Wed Apr 04, 2007 4:33 am
by mikembley
Im Ok with PHP but as i am learning i find it is sometimes hard to find the things you want to know, So i came here :)

Code: Select all

//Array held in $aData

Array
(
    [0] => Array
        (
            [0] => 817
            [1] =>  5.6" Venus TFT Photo Player White - PhotoMP3VideoGameClock SDCF Flash with USB2 & Remote  
            [2] => 63.43
            [3] => Takes Care of all your Photo's - MP3 - Display Clock - Slide Show - Voice Recorder
            [4] => 1
            [5] => 817
            [6] => 

            [iFindAll] => 252
        )

    [1] => Array
        (
            [0] => 818
            [1] => 7" Scan Widescreen Pframe USB2 MP4321 DiVX Remote & All in 1 Flash card Reader TVOut Audio Out
            [2] => 66.60
            [3] => Ideal for the Home - Show all your photo's! - The Quick & Easy way to view and share uour pictures instantly.
            [4] => 1
            [5] => 818
            [6] => 
        )

    [2] => Array
        (
            [0] => 819
            [1] =>  7" ATMT MINIVIEW Widescreen Digital Photo Frame 
            [2] => 80.07
            [3] => 7" TFT Active Matrix LCD 
            [4] => 1
            [5] => 819
            [6] => 
        )
)
What i want to do is sort $aDatas arrays by price, Which would be $aData[$i][2] .

Ive tried multiple methods, but i cant seem to make anything of them, Hopefully someone will be able to help

Would this be a 2-dimensional array? Im learning as i go by.

Thanks

Posted: Wed Apr 04, 2007 7:56 am
by feyd

Posted: Wed Apr 04, 2007 8:23 am
by mikembley
Could you give me an example in my case?

I've tried Multisort, but it didn't seem to work.. Possibly because i didn't do it the right way.

Thanks for the reply.