I have a few session arrays which I happen to be removing specific indexes from. For example, I have a session named $_SESSION['products']
, this session has these elements: $_SESSION['products'][0]
, $_SESSION['products'][1]
, and $_SESSION['products'][2]
.
I am trying to remove any one of those variables, the problem is when you remove the second variable, you mess up the array so that it cannot be displayed in a for loop. Is there a way to rearrange the following: $_SESSION['products'][0]
and $_SESSION['products'][2]
to $_SESSION['products'][0]
and $_SESSION['products'][1]
with a PHP built-in function? If not, is it even possible?