thesavior
01-01-2007, 03:43 AM
How can i do something like this:
$ranks[$rank]
I have a populated $ranks array that looks like this:
$ranks = array(
'Recruit' => '1',
'Private' => '2',
'Private 1st Class' => '3',
'Gunner Silver' => '4',
'Gunner Gold' => '5',
'Corporal Silver' => '6',
'Corporal Gold' => '7',
'Lance Corporal Silver' => '8',
'Lance Corporal Gold' => '9',
'Master Corporal Silver' => '10',
'Master Corporal Gold' => '11',
'Sergeant Silver' => '12'
);
Then $rank is supposed to be one of the values on the left hand side of the above array. I want the number attributed to the text returned in $rank. Any ideas?
$ranks[$rank]
I have a populated $ranks array that looks like this:
$ranks = array(
'Recruit' => '1',
'Private' => '2',
'Private 1st Class' => '3',
'Gunner Silver' => '4',
'Gunner Gold' => '5',
'Corporal Silver' => '6',
'Corporal Gold' => '7',
'Lance Corporal Silver' => '8',
'Lance Corporal Gold' => '9',
'Master Corporal Silver' => '10',
'Master Corporal Gold' => '11',
'Sergeant Silver' => '12'
);
Then $rank is supposed to be one of the values on the left hand side of the above array. I want the number attributed to the text returned in $rank. Any ideas?