I apologize in advance for this question - I'm sure it's been answered before, (hell, I've done it before), I just can't find anything in the search and my brain is drawing a blank...
I have an array in PHP where print_r
outputs:
Array
(
[0] => VALUE
[1] => VALUE
[2] => VALUE
[3] => VALUE
[4] => VALUE
)
I use unset($_SESSION['item'][$lineID]);
to unset a particular line from the array, and I'm left with:
Array
(
[0] => VALUE
[1] => VALUE
[3] => VALUE
[4] => VALUE
)
Element [2]
has been removed, so the resulting array is no longer numerically in order
(e.g. - [0][1][3][4]
instead of [0][1][2][3]
).
What PHP command do I run on the resulting array to "take out blanks" and reformat it so that it is numerically in order from 1 to n