While working with arrays, I came to a fundamental question about arrays in PHP:
$ar1 = [ '0' => 1, '1' => 2 ];
$ar2 = [ 1, 2 ];
print_r($ar1 === $ar2); // 1
So, does this mean, that numeric arrays are basically associative arrays? Are they implemented the same way? Or can you assume any numeric array to pretty much be a special case of an associative array?
source https://stackoverflow.com/questions/76870311/php-associative-vs-numeric-arrays
No comments:
Post a Comment