Re: usort inside a class

From: Date: Fri, 09 May 2008 20:54:32 +0000
Subject: Re: usort inside a class
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-274106@lists.php.net to get a copy of this message
It works thanks a lot! --- On Fri, 5/9/08, Richard Heyes <richardh@phpguru.org> wrote: > From: Richard Heyes <richardh@phpguru.org> > Subject: Re: [PHP] usort inside a class > To: itmaqurfe@yahoo.com > Cc: php-general@lists.php.net > Date: Friday, May 9, 2008, 8:47 PM > > i'm trying to build a class that sorts a > multidimensional array. > > I'm using the php function "usort". > > > > I declared the comparision function as a method of my > class but i'm unable to give it as argument to the > function usort. > > > > this "usort($this->arr, $this->cmpi)" > gaves the following error: usort() [function.usort]: > Invalid comparison function > > > > i tried to do "usort($this->arr, > 'cmpi')" but it does not work either. > > If it's anything like other functions, try this: > > usort($this->arr, array($this, 'cmpi')); > > -- > Richard Heyes > > +----------------------------------------+ > | Access SSH with a Windows mapped drive | > | http://www.phpguru.org/sftpdrive | > +----------------------------------------+ ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

« previous php.general (#274106) next »