Home  >  Article  >  Backend Development  >  php怎么读一个多维数据动态的

php怎么读一个多维数据动态的

WBOY
WBOYOriginal
2016-06-13 11:52:281107browse

php如何读一个多维数据动态的、
Array
(
    [3] => Array
        (
            [0] => Array
                (
                    [seconds] => 16930
                    [no] => 0
                    [pt] => 3
                    [k] => 119981343
                    [size] => 906330
                )

        )

    [2] => Array
        (
            [0] => Array
                (
                    [seconds] => 16930
                    [no] => 0
                    [pt] => 2
                    [k] => 119980914
                    [size] => 472101
                )

        )

    [4] => Array
        (
            [0] => Array
                (
                    [seconds] => 16930
                    [no] => 0
                    [pt] => 4
                    [k] => 119981696
                    [size] => 1735787
                )

        )

    [99] => Array
        (
            [0] => Array
                (
                    [seconds] => 16930
                    [no] => 0
                    [pt] => 99
                    [k] => 119981988
                    [size] => 679868
                )

        )

)




我如何读到其内的值,就是no pt k size
这是一个动态数据,就是说3,2,4,99不是固定的,因此不能用此法:[4][0][no]
应该怎么办啊?
------解决方案--------------------

foreach($ar as $r) {<br />  echo $r[0]['k'];<br />}

------解决方案--------------------
foreach($ar as $r) {
  foreach($r as $row){
    echo $row['k'];
  }
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn