$x = array(1, 2, 3, 4, 5);Delete an element from the above array. After deleting the element, integer keys must be normalized.
<?php $x = array(1, 2, 3, 4, 5); var_dump($x); unset($x[3]); $x = array_values($x); echo ' '; var_dump($x); ?>
Sample Output:
array(5) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) [4]=> int(5) } array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(5) }
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
array(5) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) [4]=> int(5) } array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(5) }need an explanation for this answer? contact us directly to get an explanation for this answer