Must all of the keys of an array be of the same type?
时间: 2024-05-21 19:18:50 浏览: 70
比较两个数组元素是否相同
5星 · 资源好评率100%
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.
阅读全文