Must all of the keys of an array be of the same type?
时间: 2024-05-21 10:18:50 浏览: 76
99 bottles of oop
In most programming languages, all keys of an array must be of the same data type. This is because arrays are usually implemented as contiguous blocks of memory, so each element must take up the same amount of space. However, some languages like PHP allow mixed types for associative arrays, where the keys are strings. Overall, it depends on the language and its implementation of arrays.
阅读全文