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

关于数组循环有关问题

WBOY
WBOYOriginal
2016-06-13 13:50:21913browse

关于数组循环问题
我有一个二维数组如: 
$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>
Statement:
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