PHP count items in a multi-dimensional array

前端 未结 9 1143
走了就别回头了
走了就别回头了 2021-01-11 19:54

As you can see from the following array, there are three elements that appear on Nov 18, and another two elements that appear on Nov 22. Can someone tell me how I can retri

9条回答
  •  一个人的身影
    2021-01-11 20:35

    Assuming that your array example is representative:

    foreach ($array as $key => $value)
    {
       echo count($value) . "
    "; }

    Will echo the number of arrays within each of the main array items. In your example, that would also be the number of entries for each date.

    This does not of course check the dates themselves

提交回复
热议问题