PHP: After Unset Array it Brings up Number Elements

Have you ever true to unset an array:

 <?php unset($array);?>  

And for some reason it adds those number elements are not number correctly and consequently:

 array(3) {
  [2] => int(3)
  [3] => int(4)
  [4] => int(5)
} 

And you want to rebase array keys after unsetting elements?

The best way is to use the PHP’s function array_values.

 $array = array_values($array); 

And viola, the problem is fixed.

 array(3) { [0] => int(3) [1] => int(4) [2] => int(5) }