Home  |  Linux  | Mysql  | PHP  | XML
From:Richard Heyes Date:Fri May  9 14:47:47 2008
Subject:Re: usort inside a class
> 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    |
+----------------------------------------+
Navigate in group php.general at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants