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 i send the information from one page to another page using post method.How can I sort an array keeping the correlation between the index and value?
How can I create an array of numbers easily?
How do we sort an array of names taken from a text file, displaying only unique names?
How can I easily view all members of an array?
