PHP array output

Source: Internet
Author: User
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];}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.