search

Home  >  Q&A  >  body text

Using list and each together, how to change the line after outputting one line?

<?php$arr=array( 'Teaching Department'=>array( '), array('Zhang 1','21','demon'), ), 'Propaganda Department'=>array( array('Li 2','18','demon'), array('Gao 2','20','Male'),  array('Zhang 2','21','Yao Ren'), ), 'Finance Department'=>array( array('Li 3','18', 'Shemale'), array('High 3','20','Male'), array('Zhang','21','Monster'), ),);foreach($arr as $k=> ;$a){echo'<table width="500" border="1">'; >$e){ echo '< ;/table>'; }       ?>

梁雪雷梁雪雷1252 days ago1020

reply all(4)I'll reply

  • autoload

    autoload2021-09-06 09:46:03

    QQ截图20210906095222.png

    The output should be in this style

    reply
    1
  • autoload

    autoload2021-09-06 09:42:23

    foreach($arr as $k=>$a)
    {    
            echo'';  
            echo $k ;                  
            foreach($a as $b=>$c){         
             echo "<tr>";                    
                    foreach($c as $d=>$e){                                                  
                    $i=list($one,$two,$three)=$e;                         
                    echo ''.$i.'';  
             echo "</tr>";                                          
            }                         
                      
            }                      
            echo ''; 
    }

    Add

    and

    # at the beginning and end of the first layer of foreach. ##

    reply
    1
  • 梁雪雷

    Thank you, teacher

    梁雪雷 · 2021-09-06 09:43:21
    autoload

    It should be the second floor

    autoload · 2021-09-06 09:44:53
  • Cancelreply