RE: [PHP] sorting for thinkers:)

From: Date: Wed, 12 Dec 2001 00:16:14 +0000
Subject: RE: [PHP] sorting for thinkers:)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-77383@lists.php.net to get a copy of this message
Put the email addresses in an array: $email[] = "bla@abc.com"; $email[] = "bla@bcd.com"; $email[] = "bla@abc.com"; Then sort like so: function cmp ($a, $b) { return strcmp(stristr ($a, "@"), stristr ($b, "@")); } usort($email, "cmp"); You now have a properly sorted $email array. -----Original Message----- From: Rambo Amadeus [mailto:avdija@epn.ba] Sent: Tuesday, December 11, 2001 3:59 PM To: php-general@lists.php.net Subject: [PHP] sorting for thinkers:) Hi, let say that i have 3 e-mail adresses in mysql. bla@abc.com bla@bcd.com bla@abc.com How can i sort them alphabeticaly but by domain name. That all abc.com domains go first, then bcd.com, then cde.com etc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#77383) next »