sorting array
| From: | Earl | Date: | Fri, 16 May 2003 20:06:48 +0000 |
| Subject: | sorting array | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-27834@lists.php.net to get a copy of this message | ||
hey guys, I need a little assistance here.
I've got an array like the one below
==========================================
$league =
array("NFL"=>1,"NCAAF"=>2,"NBA"=>3,"NCAAB"=>4,"C_BASE"=>6,"NHL"=>7,"WNDA"=>8,"WCS"=>9,"BOX"=>10,"PGA"=>11,"TENNIS"=>12,"ARENA"=>13,
"NASCAR"=>14,"CH_HOC"=>15,"NFE"=>16,"NCAAW"=>17,"CFL"=>18);
==========================================
what i am doing is querying a db and would like to replace the value with that from the array.
eg.(
$cols['league'] has the value of (NFE)
i would like to sort through the array to replace (NFE) with the corresponding value which is (16)
i can do this using the [ if , elseif, else ] but that would have my code to long. i am only looking
for the shortest way out.
Thanks in advance for any assistance.