Decard
Decard

Reputation: 57

PHP how to get value from array with foreach

I have array $result

array(2) {
  ["Smiley TV"]=>
  array(2) {
    ["Speed"]=>
    array(2) {
      [0]=>
      string(4) "9510"
      [1]=>
      string(5) "33775"
    }
    ["Turbo"]=>
    array(2) {
      [0]=>
      string(4) "2427"
      [1]=>
      string(5) "19696"
    }
  }
  ["Victory Media"]=>
  array(1) {
    ["Speed"]=>
    array(2) {
      [0]=>
      string(4) "4144"
      [1]=>
      string(5) "80445"
    }
  }
}

How with foreach i can get values. For example in the "Smyley TV" how i can result "Speed". Also please write how i can get all data one by one. Thanks

Upvotes: 0

Views: 383

Answers (1)

Mudassar Saiyed
Mudassar Saiyed

Reputation: 1148

You can fetch this way

foreach ($arrays as $array) {
   echo $array['smyley TV'];
}

Upvotes: 1

Related Questions