Are there any potential pitfalls in using the count() function to determine the size of an array with non-sequential keys?

When using the count() function to determine the size of an array with non-sequential keys, it may not return the expected result because count() only counts elements with numeric keys starting from 0. To accurately count all elements in the array, you can use the sizeof() function instead, which counts all elements regardless of their keys.

// Using sizeof() function to accurately count all elements in the array
$array = ['a' => 1, 'b' => 2, 'c' => 3];
$size = sizeof($array);
echo $size;