shouldn't it be: uksort($array_array,"cmp"); Greets,
Edward ----- Original Message ----- From: "Sondra Russell" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 05, 2002 5:52 AM Subject: [PHP] uksort wisdom > Hi Guys! > > I'm looking to get a *deeper understanding* of uksort. My quandry: > > $array[listing1][name] = "listing 1"; > $array[listing1][premiere] = ""; > $array[listing2][name] = "listing 2"; > $array[listing2][premiere] = ""; > $array[listing3][name] = "listing 3"; > $array[listing3][premiere] = "yes"; > > I'd like the result to come out as: > $array[listing3] //(this is the one with the premiere set to "yes") > $array[listing1] // (no premiere, but in order) > $array[listing2] // (again, no premiere, but again in order) > > So far, I've got: > > function cmp= ($a,$b) { > global $array; > if ($array [$a][premiere] == "yes") { > return -1; > } else { > return ($a < $b) ? -1 : 1; > } > } > > uksort($array_array,cmp); > > But that ends up, strangely with: > $array[listing3] > $array[listing2] > $array[listing1] > > > Any wisdom? Just would like a better idea of the inner workings of uksort. > > Best, > Sondra > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php