PHP array output
Array ([0] => black ash/L (170/95) [1] => 7.62 [2] => Tibetan blue/XXL (180/105) [3] => 12.6 [4] => ash/L (170/95) [5] => 5.2 [6] => navy blue/XXXL (185/110) [7] => 6.62 [8] => black Gray/XL (175/100) [9] => 9.96 [10] => Gray/XXXL (185/110) [11] => 1.51 [12] => Gray/XL (175/100) [13] => 6.73 [14] => black Gray/XXL (180/105) [15] => 5.73 [16] => navy blue/XL (175/100) [17] => 22.27 [18] => black ash/XXXL (185/110) [19] => 3.05 [20] => Zang Qing/L (170/95) [21] => 15.17 [22] => Hua Gray/XXL (180/105) [23] = & gt; 3.54)
$ Ceshi array output 13579 first... in output 02468 ..
Note: The $ ceshi array may have more than 100 or more than 10.
How can this problem be solved?
Reply to discussion (solution)
foreach($ceshi as $k => $value){if($k % 2 == 1) echo $value;}foreach($ceshi as $k => $value){if($k % 2 == 0) echo $value;}
for($i=1; $i
$num=sizeof($ceshi);for($i=1;$i<$num;$i++){ $j=1+($i-1)*2; if($j>$num) break; echo $ceshi[$j];}for($x=1;$x<$num;$x++){ $y=2*($x-1); if($y>$num) break; echo $ceshi[$y];}