We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The problem is the array_shift() function. You have to reverse the arrays with array_reverse() and on the while loop you can use array_pop() instead of array_shift(). The array_pop() function is a little bit faster because there is no need for reindexing the array.
Equal Stacks
You are viewing a single comment's thread. Return to all comments →
The problem is the array_shift() function. You have to reverse the arrays with array_reverse() and on the while loop you can use array_pop() instead of array_shift(). The array_pop() function is a little bit faster because there is no need for reindexing the array.
I found the solution by the following comment: http://php.net/manual/en/function.array-shift.php#86783