Array sorting.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikembley
Forum Newbie
Posts: 2
Joined: Wed Apr 04, 2007 4:18 am

Array sorting.

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

mikembley
Forum Newbie
Posts: 2
Joined: Wed Apr 04, 2007 4:18 am

Post 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.
Post Reply