-4

I have an array $rates

I used print_r to see if I have the values I want. And returns the information below.

Array (
    [125] => Array (
        [2011] => Array (
            [ca] => Array (
                [8810] => Array (
                    [0] => Array (
                      [Key] => 481
                      [Code] => 8810
                      [Desc] => Clerical Office Employees - NOC
                      [Desc_escaped] => Clerical Office Employees - NOC
                      [Rate] => 0.82
                      [Exclusion] => 0
                      [peo_id] =>
                    )
                )
            )
        )
    )
) 

I have tried a number of methods to get the info I want but have been unsuccessful. I am after the value of [Rate]

Spencer
  • 297
  • 2
  • 10
TheDag
  • 5
  • 3
  • 1
    I assume that the indexes can change, but for this one it is `$rates[125][2011]['ca'][8810][0]['Rate']`. If those numbers (other than the 0) are meaningful then it should be easy to get from others. – AbraCadaver Nov 10 '17 at 21:07
  • Do you even try this? `$rates['125']['2011']['ca']['8810']['0']['Rate']` – zrkb Nov 10 '17 at 21:08
  • Thank you. Is there a way to get it when the indexes do change? – TheDag Nov 10 '17 at 21:09
  • I tried this $rates[$q_peo_id][$rate_year][$state]['Rate'] – TheDag Nov 10 '17 at 21:11
  • If those vars are correct then you are missing one var (8810) and a 0: `$rates[$q_peo_id][$rate_year][$state][8810][0]['Rate']`. So where does 8810 come from? – AbraCadaver Nov 10 '17 at 21:14
  • @AbraCadaver Nailed it... Thanks $rates[$q_peo_id][$rate_year][$state][$scopes_code][0]['Rate'] worked perfectly. I left out one $scopes_code. – TheDag Nov 10 '17 at 21:20

1 Answers1

0

Try

$rates[125][2011]['ca'][8810][0]['Rate'];
Daniel
  • 597
  • 6
  • 15