I have got array with irregular number of keys, for example:
array: [ 0 => true, 2 => false, 3 => true, 8 => true ]
I want to see array like this:
array: [ 0 => true, 1 => false, 2 => true, 3 => true ]
How i can do this?
I have got array with irregular number of keys, for example:
array: [ 0 => true, 2 => false, 3 => true, 8 => true ]
I want to see array like this:
array: [ 0 => true, 1 => false, 2 => true, 3 => true ]
How i can do this?
You can use a builtin array_values
PHP function, as shown below:
$arr = array_values($oldArray);
array_values does that :) http://php.net/manual/en/function.array-values.php
$fixedArray = array_values($arr);