-2

我有多维数组,我无法计算出如何计算多维数组中有多少个数组,count($array) 不起作用。数组如下

     Array
       (
    [data] => Array
        (
        [0] => Array
            (
                [type] => text
                [fname] => Empty
                [value] => 
                [req] => Yes
                [valType] => None
                [errorMsg] => 
            )

        [1] => Array
            (
                [type] => tickbox
                [fname] => Empty
                [value] => Empty
                [req] => Yes
                [valType] => None
                [errorMsg] => 
            )

        [2] => Array
            (
                [type] => select
                [fname] => Empty
                [req] => Yes
                [valType] => None
                [optionsList] => Array
                    (
                        [0] => :empty
                    )

                [errorMsg] => 
            )

    )

 )

计数返回 1,但我正在寻找的结果是 3。任何帮助都会非常感谢

伊恩

4

1 回答 1

1

尝试计算数组中的数组:count($array['data']);

于 2013-11-05T21:30:36.707 回答