note 1622 deleted from usort by danbeck
| From: | danbeck@php.net | Date: | Thu, 10 Aug 2000 02:36:02 +0000 |
| Subject: | note 1622 deleted from usort by danbeck | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-746@lists.php.net to get a copy of this message | ||
When sorting a multi-dimensional array, $a and $b contain refrences to the 1st array.
Say you have an array that you want to sort by one of the fields in the second array: (i.e.
$list[$i]["date"])
function compare($a,$b)
{return strcmp($a["date"],$b["date"]);}
usort($list,compare);
In this example $a & $b point to $list[$i}