On Mon, May 21, 2001 at 06:05:49PM -0700, Alex Black wrote :
> > Use 'uasort()':
> >
> > function my_hash_sort( $a, $b) {
> > $a = $a['num'];
> > $b = $b['num'];
> > if( $a == $b) return 0;
> > return ( $a > $b) ? -1 : 1;
> > }
> >
> > uasort( $test, 'my_hash_sort');
>
> hoping this wouldn't be the answer, thanks :)
>
> another for you:
>
> I've now coded my function, and the ordering works fine.
>
> except I'm inside a class and would really rather not include some strange
> little file with a single function in it. <kludge>my code here</kludge>
>
> on a whim, I tried
> uasort($this->modules[$group], '$this->_ary_sort()');
>
> with no luck :)
>
> ideas?
sure :)
use
uasort( $this->modules[ $group], array( &$this, '_ary_sort'))'
You could also write '$this' instead of '&$this' and it would
work but would unneccessarily create a new copy of the object.
- Markus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]