0

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

Decard
  • 57
  • 7
  • Looks like you do not know how to access array elements... A hint: `$myArray["Victory Media"]["Speed"][0]`... – arkascha Mar 11 '17 at 11:47
  • I hope this will show you idea. Also check out PHP manual [foreach](http://php.net/manual/en/control-structures.foreach.php). foreach($array as $key => $item){ if($key == 'Smiley TV'){ $item['speed];} } – Radosław Halicki Mar 11 '17 at 11:48

1 Answers1

1

You can fetch this way

foreach ($arrays as $array) {
   echo $array['smyley TV'];
}
Brett Gregson
  • 5,867
  • 3
  • 42
  • 60
Mudassar Saiyed
  • 1,146
  • 10
  • 20