Re: help with sort problem

From: Date: Sun, 12 May 2002 21:09:29 +0000
Subject: Re: help with sort problem
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-97249@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 * and then Jason Wong declared.... > If that is what you want then: > while (names) { > explode the name > if there is more than one element swap it, then join > add this processed name onto a new array > } > > use one of the array sort functions to sort the new array. Yep, cheers Jason, here's what I came up with function sort_teachers() { global $teach; $array_2_sort=array(); foreach($teach->list_teachers() as $key => $val) { $split=explode(" ", $val["name"]); $array_2_sort[$key]=end($split); } asort($array_2_sort); return($array_2_sort); } - -- Nick Wilson // www.explodingnet.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE83toJHpvrrTa6L5oRApkiAJ0YwgusbS4uBaJWOo2eory16FnM7ACfcPS0 JXjm2JXTWeN22KTs7dJwrWI= =Z7zE -----END PGP SIGNATURE-----

« previous php.general (#97249) next »