tags:

views:

47

answers:

1

I have a variable that looks likes this,

$rslt['expected_salary_level']

This returns a string similar to LEVEL_3, in another array that looks like this I have a set of salaries,

    Array
(
    [LEVEL_1] => Array
        (
            [nice_name] => under £10,000
            [low] => 1
            [high] => 10000
        )

    [LEVEL_2] => Array
        (
            [nice_name] => £10,000 - £15,000
            [low] => 10000
            [high] => 15000
        )

    [LEVEL_3] => Array
        (
            [nice_name] => £15,000 - £20,000
            [low] => 15000
            [high] => 20000
        )

    [LEVEL_4] => Array
        (
            [nice_name] => £20,000 - £25,000
            [low] => 20000
            [high] => 25000
        )

    [LEVEL_5] => Array
        (
            [nice_name] => £25,000 - £30,000
            [low] => 25000
            [high] => 30000
        )

    [LEVEL_6] => Array
        (
            [nice_name] => £30,000 - £40,000
            [low] => 30000
            [high] => 40000
        )

    [LEVEL_7] => Array
        (
            [nice_name] => £40,000 - £50,000
            [low] => 40000
            [high] => 50000
        )

    [LEVEL_8] => Array
        (
            [nice_name] => £50,000 - £100,000
            [low] => 50000
            [high] => 100000
        )

    [LEVEL_9] => Array
        (
            [nice_name] => £100,000 or more
            [low] => 100000
            [high] => 9999999
        )

    [LEVEL_VOLUNTARY] => Array
        (
            [nice_name] => Voluntary
            [low] => 
            [high] => 
        )

    [LEVEL_UNSPECIFIED] => Array
        (
            [nice_name] => Not specified
            [low] => 
            [high] => 
        )

)

How do I get at the associated nice name?

+8  A: 

If I understand you correctly, $rslt['expected_salary_level'] returns the key for this array in your example. Assuming that this array is called $array, I think this is what you want:

$array[$rslt['expected_salary_level']]['nice_name']
Syntactic