How do I remove an element from an array without changing the index values for the rest of the array?
For instance, if you create an array of the numbers from A - Z then the index values are 0 - 25.
If you then unset the value at index 2 (C) then the rest of the array keeps its index - value correlation intact.
<?php
$letters = range("A","Z");
unset($letters[2));
print_r($letters);
?>
Copy and paste that to see the results... if that wasn't the question you were asking then please re-post with more explicit details of what you're looking for.
Comment on this Question and Answer >>>
ASK A QUESTION
More arrays PHP Questions
How do we sort an array of names taken from a text file, displaying only unique names?how a values entered in an array from keyboard?
How do I turn an array into a string?
How do I remove the first element from an array?
How do I return all the values in an array?
