function cmp ($a, $b) { if ($a['manufacturer'] == $b['manufacturer']) return 0; return ($a['manufacturer'] > $b['manufacturer']) ? -1 : 1; }
Ashley M. Kirchner wrote:
I have an array that looks like this:
$i = 0; $item[$i] = array( 'link' => 'http://...', 'image' => '/images/image.jpg', 'title' => 'some title', 'price' => '$14.00', 'cat' => 'Frames', 'author' => 'Pinochio', 'artist' => '', 'asin' => '010101', 'manufacturer' => 'Post' ); $i++; $item[$i] = array( 'link' => 'http://...', 'image' => '/images/something.jpg', 'title' => 'this is fun', 'price' => '$2.99', 'cat' => 'Card', 'author' => 'Mickey', 'artist' => '', 'asin' => '1116221', 'manufacturer' => 'Kraft' ); $i++; etc., etc.
I would like to sort $items based on the manufacturer of each array within. So that, in the above example, the second one would come before the first. Is there a way to do that?
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php