On Sat, 6 Apr 2002 10:36:18 -0600, Peter J. Schoenster
<[EMAIL PROTECTED]> wrote:
> $ArrayOfNewsLinks = array(
> "http://dailynews.yahoo.com/fc/World/Brazil/" => array(
> title => 'Yahoo Brazil News',
> category => 'news',
> language => 'English',
>
> ),
...
> function cmp ($a, $b) {
> if ($a[2] == $b[2]) return 0;
> //return strcmp ( $a[2], $b[2]); // thought this would work
> return ($a[1]>$b[1])?1:-1;
> }
>
>
> uksort ($ArrayOfNewsLinks, "cmp");
Try changing those subscripts to keys:
if ($a["language"] == $b["language"])
etc. You should have a ton of PHP warnings generated from the code
above, as numeric elements won't exist.
As a side note, an interesting addition would be using the title as a
second sort key:
if ($a["language"] == $b["language"]) {
return strnatcasecmp($a["title"], $b["title"]);
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php