PhpDig.net

Go Back   PhpDig.net > General Forums > Coding & Tutorials

Reply
 
Thread Tools
Old 05-23-2004, 11:43 AM   #1
griffinmt
Green Mole
 
Join Date: May 2004
Location: Michigan
Posts: 9
Question Sorting within Class

Having trouble using usort within a class.
Example:
class User {
var $fn;
var $ln;
var $id;
function User() { ...}
...
}
class Users {
var $list = array();
function Users() {...}
function addUser($U) {array_push($this->list,$U);}
...
}

above are two classes, the second (Users) is an array of User class objects. From within Users, I would like to sort the array (using usort) such that the elements are in sequence by User->ln

Cannot get it to invoke the comparison function and the result is a somewhat r****me sequence.

What is the most efficient way to call the usort and code the associated coomparision function?

Thanks
griffinmt is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting results ddrplayer How-to Forum 1 07-17-2008 12:55 AM
mg-eregi() again... premature end of char class... casimiro Troubleshooting 0 12-22-2005 04:05 AM
phpdig highlight class only for first search word manute Bug Tracker 6 11-26-2003 10:10 AM


All times are GMT -8. The time now is 09:51 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.