How to flip an array without using any predefined functions in PHP .. I had a solution to this problem ... here is my solution ........
<?php // normal array -------- $myarray = [1,2,3,4,5,6,7,8,9]; //---------------- $arr = []; for($i=9; $i > -1; $i--){ if(!$i==0){ $arr[]= $i; } } print_r($arr); //the out put is [9,8,7,6,5,4,3,2,1]; ?>
mring17
source share