Home >Backend Development >PHP Tutorial > for中又for,大侠们教下

for中又for,大侠们教下

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 13:25:58898browse

for中再for,大侠们教下。
 
$p='1$a$aa#2$bb$b#3$ccc#4$dddd$ddd';
global $a,$k;
$c = explode('#',$p);
for($i=0;$i
  $d = explode('$',$c[$i]);
  for($j=0;$j   $a.= '

  • '.$d[$j].'
  • ';
      }
      
     $k.='
      '.$c[$i].'
    '; 
    }
    echo "$k";

    ?>

    上面的出来只有


            要怎么搞才能显示这样的
            • 1
            • a
            • aa

            • 2
            • bb

            • 3
            • ccc

            • 4
            • dddd
            • ddd


            最好能说的简单点,谢谢

            ------解决方案--------------------
            PHP code
            $p='1$a$aa#2$bb$b#3$ccc#4$dddd$ddd';
            global $a,$k;
            $c = explode('#',$p);
            for($i=0;$i<count explode for>'.$d[$j].'';
              }
              $k.='<ul>'.$a.'</ul>'.PHP_EOL;   //注意这里
            }
            echo "$k"; <div class="clear">
                             
                          
                          
                    
                        </div></count>
            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