Hi,

I have the array below and I want to sort on language. Can't figure it 
out. Below the array is what I tried

$ArrayOfNewsLinks = array(
  "http://dailynews.yahoo.com/fc/World/Brazil/"; => array(
    title => 'Yahoo Brazil News',
    category  => 'news',
    language => 'English',

  ),
  "http://news.bbc.co.uk/hi/english/world/americas/default.stm"; => 
array(
    title => 'BBC 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");

But then I do this:

while (list ($key, $val) = each ($ArrayOfNewsLinks)) {  
    $NewsLinks .= "
<p class=\"CompactLinks\">
<a href=\"$key\" title=\"$val[language] $val[title]\" 
target=\"new\">$val[title]</a>
</p>

";    

}

And the order is not by language.

Peter

http://www.readbrazil.com/
Answering Your Questions About Brazil

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to