<?php $array = ['a', 'b', 'c', 'd', 'e']; function customReverse($array) { $reversedArray = []; $count = count($array); for ($i = 0; $i < count($array); $i++) { $reversedArray[] = $i % 2 === 0 ? $array[$i / 2] : $array[$count - ($i / 2)]; } return $reversedArray; } print_r(customReverse($array));
You have javascript disabled. You will not be able to edit any code.