3 ms·
Yeah, an array essentially becomes an associative array. For example in another language I could do something like: if (!empty($filteredArray)) { print($filt
by arnvald 6y ago
Yeah, an array essentially becomes an associative array.
For example in another language I could do something like:
if (!empty($filteredArray)) { print($filteredArray[0] }
But in PHP I need to remember that after every array_filter, after every unset etc. I need to reindex the array, because [0] element might not be there
- greenshackle2 6y agoIt was an associative array all along, PHP just hides that from you. The Array is such a quirky data structure, it takes int or string keys, but numeric string keys ("1", etc.) are silently converted to int. It's never a real array, the implementation under the hood is a hash table.