Source Code:
(back to article)
<?php $arr1 = [ 'w3docs', // [0] 'for', // [1] 'w3docs', // [2] ]; // remove the item at index 1, which is 'for' unset($arr1[1]); // Print modified array var_dump($arr1); // Reindex the array elements $arr2 = array_values($arr1); // Print re-indexed array var_dump($arr2);
Result:
Report an issue