note 44690 deleted from function.array-multisort by betz

From: Date: Fri, 13 Aug 2004 16:26:57 +0000
Subject: note 44690 deleted from function.array-multisort by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79801@lists.php.net to get a copy of this message
Note Submitter: Francois A. ---- //This WORKS, and this is SIMPLE. $products[0][price] = 2; $products[0][name] = "b"; $products[0][cat] = "good"; $products[0][options][1] = 2; $products[0][options][2] = 3; $products[1][price] = 4.78; $products[1][name] = "a"; $products[1][cat] = "bad"; $products[2][price] = 1.85; $products[2][name] = "c"; $products[2][cat] = "good"; $products[2][options][1] = 2; $products[2][options][2] = 3; // Sort by price foreach ($products as $row) $sortArray[] = $row[price]; array_multisort($sortArray, $prod); // Note that array_multisort($sortArray, $prod) WORKS // and array_multisort($prod, $sortArray) WILL NOT WORK // Don't mix it up, test it // Print out the results print_r($prod);

« previous php.notes (#79801) next »