Answer the question
In order to leave comments, you need to log in
How to flip an array correctly?
PHP gurus tell me please, there is a basket in php + AJAX, I write goods to the session, then I display them through AJAX in a loop: foreach ($_SESSION['basket'] as $key => $value) {
Everything works. Now I want to show the array "back to front" I use:
foreach (array_reverse($_SESSION['basket']) as $key => $value) {
Answer the question
In order to leave comments, you need to log in
Parameter listphp.net/manual/en/function.array-reverse.php
array: The input array.
preserve_keys: If set to TRUE, the keys will be preserved. Non-numeric keys are not affected by this option and are always preserved.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question