Re: array sort

From: Date: Tue, 22 May 2001 01:05:49 +0000
Subject: Re: array sort
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-53800@lists.php.net to get a copy of this message
> 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? tia, _alex

« previous php.general (#53800) next »