Re: PHP sort from a database variable..?

From: Date: Tue, 03 Jun 2003 22:48:28 +0000
Subject: Re: PHP sort from a database variable..?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-28273@lists.php.net to get a copy of this message
ok, add the following lines to your ingress.lib-file: /***********************/ // converts any array to an instance of the ingress-class function array2IngressClass($array) { $inst = new ingress(); while(list($key, $val) = each($array)) $inst->$key = $val; return $inst; } // converts any class into an array function class2Arr($class) { return (array)$class; } // sorts arrays comeing from hentIngresser() descending function sortClassArray($array) { $arr = array(); $sArr = array(); foreach($array as $ent) { $arr[] = class2Arr($ent); $sArr[] = $ent->publisertLang; } array_multisort($arr, SORT_DESC, $sArr); $cM = count($arr); for($c = 0; $c < $cM; $c++) $arr[$c] = array2IngressClass($arr[$c]); return $arr; }

« previous php.db (#28273) next »