Your PHP array indices getting messed up when unsetting values?

Thats because in PHP arrays are internally handled like hashes. Let me give you an example: <?php // Lets assumme we have an array of numbers $numbers = array(1, 2, 3, 4, 5); // Which we are going to inspect var_dump($numbers); // Output is /* array(4) { [0] => int(1) [1] => int(2) [2] => int(3) [3] => int(4) [4] => int(5) } */ // And we are going to unset the 3rd element unset($numbers[2]); // Lets inspect again var_dump($numbers); // Output is /* array(4) { [0] => int(1) [1] => int(2) [3] => int(4) [4] => int(5) } */ ? … »