0
posted
unset never reset the Internal pointer in php , why ?
why Internal pointer never reset or never get minus ?
$value[]=1;
$value[]=2;
unset($value[1]);
$value[]=2;
print_r($value)//Array ( [0] => 1 [2] => 2 )
when we do unset($value[1]); it remove array value from index 1 but if add new value it goes to next increment internal pointer , it is 2 in our case . it means php will not reuse it next time until whole array not redefined or restart.
why it is there is no intelligent indexing are there in php . in mostly array
why unset only remove value and index but dont fill it again when next value come up to push.