dongsimang4036
dongsimang4036
2017-03-11 11:42
浏览 47
已采纳

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
    dsfds656545 2017-03-11 11:49
    已采纳

    You can fetch this way

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

相关推荐