note 73915 rejected from function.usort by bobby
| From: | bobby@php.net | Date: | Thu, 15 Mar 2007 15:10:44 +0000 |
| Subject: | note 73915 rejected from function.usort by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-124484@lists.php.net to get a copy of this message | ||
Note Submitter: toader_alexandru at yahoo dot com
----
I have to order some colons from php (not from sql) and I try to use usort().
Unfortunately I found no way to have a third argument to MyCompare function - the compared element
from my array - so I had to make some lots of functions like Compare1 to Compare30 :)
not to elegant right?
I have now something like:
function Compare1($FirstArray, $SecondArray)
{
if($FirstArray['gamename'] == $SecondArray['gamename'] )
{
return 0;
}
return (($FirstArray['gamename'] > $SecondArray['gamename']) ? 1 : -1);
}
I would have been very happy to be allowed to have:
function Compare1($FirstArray, $SecondArray, $ComparedElement)
{
if($FirstArray[$ComparedElement] == $SecondArray[$ComparedElement] )
{
return 0;
}
return (($FirstArray[$ComparedElement] > $SecondArray[$ComparedElement]) ? 1 : -1);
}
Any ideas?
Thanks
PS
I also did not found where to request a feature.
I understand you will delete my post but maybe you will be so kind to put it in the request features
page.