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

2
  • Looks like you do not know how to access array elements... A hint: $myArray["Victory Media"]["Speed"][0]... Commented Mar 11, 2017 at 11:47
  • I hope this will show you idea. Also check out PHP manual foreach. foreach($array as $key => $item){ if($key == 'Smiley TV'){ $item['speed];} } Commented Mar 11, 2017 at 11:48

1 Answer 1

1

You can fetch this way

foreach ($arrays as $array) {
   echo $array['smyley TV'];
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.