echo count(array("1" => "A", 1 => "B", "C", 2 => "D"));
This outputs 2. I’ve played around with it and noticed that PHP identifies both string numbers and integers the same when used as keys in an array. Seems like integers are prioritized. Also when I var_dump the array only elements containing the value “B” and “D” are displayed. I understand why “A” is not displayed but why is “C” not in the var_dump?
Your array is basically being built as follows:
Thus your resulting array is
array(1=>"B",2=>"D");