Array
(
[0] => Array
(
[name] => WWW
)
[1] => Array
(
[name] => Hi
)
[2] => Array
(
[name] => Hello
)
[3] => Array
(
[name] => World
)
)
I have the above array and I want to count the number of keys.
When using the following code
$temp = array_keys($array);
echo $temp;
the result is 2 instead of 4 (0,1,2,3). What I'm doing wrong ?
count($array). There's always the same amount of keys as there are values!array_keysreturns an array. So how can the result be '2'??echo $temp;should be'Array', sincearray_keysreturns an array of the keys.