Homer_J
Homer_J

Reputation: 3323

PHP Count number of Arrays

Simple question that I am struggling to find answer for. I have an array as follows:

Array (
    [0] => Array ( [0] => 2014-05-14 02:11:16 [1] => 1 ) 
    [1] => Array ( [0] => 2014-05-19 05:05:17 [1] => 76 ) 
    [2] => Array ( [0] => 2014-05-20 00:28:41 [1] => 35 ) 
    [3] => Array ( [0] => 2014-05-21 01:24:01 [1] => 25 )
)

All I need to do is count how many Arrays there are.

The answer based on the above would be 4 (0,1,2&3).

I am positive this is a very simple thing but I cannot fathom how - any and all suggestions welcomed.

Upvotes: -1

Views: 87

Answers (1)

potashin
potashin

Reputation: 44601

Using count() should work for you :

$num = count($array);

Upvotes: 1

Related Questions