dongsimang4036 2017-03-11 11:42 采纳率: 100%
浏览 61
已采纳

PHP如何使用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

  • 写回答

1条回答 默认 最新

  • dsfds656545 2017-03-11 11:49
    关注

    You can fetch this way

    foreach ($arrays as $array) {
       echo $array['smyley TV'];
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?