Soagain, ifyou'relikewith a scriptthat I'm goingtoshowyou, ifyouhavecolorsofsomethinglike a T shirt, yousortthosecolorsalphabeticallyandthentheycanseehowmanyofthoseparticularshirtsthatyouhave.
It's justeasier, right.
Havinghavingbluebecomecomebeforeorangewhensomebody's readingdown a listjustmakes a lotmoresensetothebrain.
Sooneofthingsthatyoucoulddowithanarrayisyouconsortbythekey, notjustbythevaluesinthearray, sothatlet's gooverthecomputerand I cangiveyou a demonstrationofhowthisworks.
Soherewehave a simplescriptthat I createdtoshowyouhowtosorttheraysbykeyscalled a raykeysortdotPHP.
Asalways, weopenedwith a PHPtagandwhatwe'regoingtodonowsaysthisisgonnabelikeaninventorytypesimulation, sowe'regoingtocreate a variabledollarinventoryandthenwe'regoingtosetittothevalueofanarray.
Sothisisallthatyouhavetodoinordertocreate a namedkeyarray, beabletoprintitoutasitis, you'regoingtocasesorttosortitalphabetically, andthenyou'regoingto k r sortdisorderedreversealphabetically.
Thatwouldplugallthisin a silicondododotcomarraykeysort.