Home > Backend Development > PHP Tutorial > 关于数组循环有关问题

关于数组循环有关问题

WBOY
Release: 2016-06-13 10:05:03
Original
918 people have browsed it

关于数组循环问题
我有一个二维数组如: 
$matrix_detail = array('x' => array('横1','横2','横3'),'y' => array('纵1','纵2','纵3','纵4')); 
想根据这个数组,循环出这样的一个效果: 

  横1 横2 横3 
纵1 O O O 

纵2 O O O 

纵3 O O O 

纵4 O O O 
无从下手,请各位指点下。谢谢

------解决方案--------------------

PHP code
foreach($matrix_detail['y'] as ykey=>yvalue){  foreach($matrix_detail['x'] as xkey=>xvalue)  {    ....  }}<div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template