View Single Post
Old 02-27-2010, 01:03 AM   #2 (permalink)
delayedinsanity
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

You've pretty much got it, except that you're comparing $a to $a.

php Code:
header( 'Content-type: text/plain' );

$demoData = 'a:6:{i:0;a:9:{s:7:"Address";s:14:"3630 NW 207 ST";s:8:"Bedrooms";s:1:"4";s:9:"BathsHalf";s:1:"0";s:9:"BathsFull";s:1:"2";s:4:"City";s:5:"Miami";s:10:"LivingArea";s:4:"1179";s:9:"ListingID";s:8:"M1317308";s:9:"ListPrice";s:6:"199000";s:5:"State";s:2:"FL";}i:1;a:9:{s:7:"Address";s:16:"630 SW 19 RD # B";s:8:"Bedrooms";s:1:"3";s:9:"BathsHalf";s:1:"0";s:9:"BathsFull";s:1:"2";s:4:"City";s:5:"Miami";s:10:"LivingArea";s:4:"2088";s:9:"ListingID";s:8:"M1345870";s:9:"ListPrice";s:6:"249382";s:5:"State";s:2:"FL";}i:2;a:9:{s:7:"Address";s:12:"13459 SW 118";s:8:"Bedrooms";s:1:"4";s:9:"BathsHalf";s:1:"1";s:9:"BathsFull";s:1:"3";s:4:"City";s:5:"Miami";s:10:"LivingArea";s:4:"2144";s:9:"ListingID";s:8:"M1352857";s:9:"ListPrice";s:6:"249900";s:5:"State";s:2:"FL";}i:3;a:10:{s:7:"Address";s:15:"4121 NW 21ST Av";s:8:"Bedrooms";s:1:"2";s:9:"BathsHalf";s:1:"0";s:9:"BathsFull";s:1:"1";s:4:"City";s:5:"Miami";s:10:"LivingArea";s:3:"941";s:17:"OriginalListPrice";s:6:"139000";s:9:"ListingID";s:8:"R3060687";s:9:"ListPrice";s:5:"99000";s:5:"State";s:2:"FL";}i:4;a:9:{s:7:"Address";s:13:"1053 SW 22 ST";s:8:"Bedrooms";s:1:"3";s:9:"BathsHalf";s:1:"0";s:9:"BathsFull";s:1:"3";s:4:"City";s:5:"Miami";s:10:"LivingArea";s:4:"1667";s:9:"ListingID";s:8:"M1329296";s:9:"ListPrice";s:6:"439000";s:5:"State";s:2:"FL";}i:5;a:9:{s:7:"Address";s:15:"10021 SW 108 ST";s:8:"Bedrooms";s:1:"4";s:9:"BathsHalf";s:1:"0";s:9:"BathsFull";s:1:"2";s:4:"City";s:5:"Miami";s:10:"LivingArea";s:4:"1977";s:9:"ListingID";s:8:"M1352823";s:9:"ListPrice";s:6:"374000";s:5:"State";s:2:"FL";}}';

$properties = unserialize($demoData);

function urmomsorts( $a, $b ) {
    return ( $a['ListPrice'] < $b['ListPrice'] ) ? -1 : 1;
}
uasort( $properties, 'urmomsorts' );

print_r( $properties );
delayedinsanity is offline  
Reply With Quote