sorting array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux