I am having a little problem, I could not understand how count function works, it I instaciate an array and fill it with 4 integers, my count function return 4 obviously, but I didnt get some example.
Here is the code :
$a = $food = array('1' => "c",1 => "A",
'2' => "D"
);
echo count($a);
The message I get is 2, but it is 3 elements, no ? So I thought, that maybe because the string key ( 1 in my case ) has to one and only one in an array even if the types of keys are different ? I am right ? It is like writing code like this :
$a[1] = "c";
$a[1] = "A";
I added something to my array :
$a = $food = array('1' => "c",1 => "A", 'C',
'2' => "D"
);
echo count($a);
And I still get 2 instead of 3 if my explanation above was right!
Can you explain to me how count works exactly ? Thank you for your help