Are there empty indexes in memory

I created an array like

arr[15] = "hello";
arr[21] = "world";

there are empty indexes from 0to 14and 15to 20. these empty indexes are stored in memory or not. they cause memory consumption. it is ok to have random indexes to support the array.

+4
source share
2 answers

PHP , , hashmaps, . , 15 14, 'foo' 'bar'. PHP . 15 PHP 0 - 14. .

+1

0 14 15 20. . .

, , ,

array

$array = array();
var_dump(isset($array));//bool(true)

. , , .

Null , .. "".

0

All Articles