• <small id='3LoNl'></small><noframes id='3LoNl'>

        <legend id='3LoNl'><style id='3LoNl'><dir id='3LoNl'><q id='3LoNl'></q></dir></style></legend>
          <bdo id='3LoNl'></bdo><ul id='3LoNl'></ul>

        <i id='3LoNl'><tr id='3LoNl'><dt id='3LoNl'><q id='3LoNl'><span id='3LoNl'><b id='3LoNl'><form id='3LoNl'><ins id='3LoNl'></ins><ul id='3LoNl'></ul><sub id='3LoNl'></sub></form><legend id='3LoNl'></legend><bdo id='3LoNl'><pre id='3LoNl'><center id='3LoNl'></center></pre></bdo></b><th id='3LoNl'></th></span></q></dt></tr></i><div id='3LoNl'><tfoot id='3LoNl'></tfoot><dl id='3LoNl'><fieldset id='3LoNl'></fieldset></dl></div>
        <tfoot id='3LoNl'></tfoot>

      1. 如何将两个 foreach 循环合二为一

        时间:2023-09-21

        <i id='keMdK'><tr id='keMdK'><dt id='keMdK'><q id='keMdK'><span id='keMdK'><b id='keMdK'><form id='keMdK'><ins id='keMdK'></ins><ul id='keMdK'></ul><sub id='keMdK'></sub></form><legend id='keMdK'></legend><bdo id='keMdK'><pre id='keMdK'><center id='keMdK'></center></pre></bdo></b><th id='keMdK'></th></span></q></dt></tr></i><div id='keMdK'><tfoot id='keMdK'></tfoot><dl id='keMdK'><fieldset id='keMdK'></fieldset></dl></div>
          <legend id='keMdK'><style id='keMdK'><dir id='keMdK'><q id='keMdK'></q></dir></style></legend>
              <tbody id='keMdK'></tbody>

            <small id='keMdK'></small><noframes id='keMdK'>

            <tfoot id='keMdK'></tfoot>

                <bdo id='keMdK'></bdo><ul id='keMdK'></ul>

                  本文介绍了如何将两个 foreach 循环合二为一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  语言是 PHP.我有一个 foreach($a 作为 $b)和另一个 foreach($c 作为 $d => $e).我如何将它们结合起来阅读.我厌倦了 foreach (($a as $b) && ($c as $d => $e)),但那是垃圾.

                  The language is PHP. I have one foreach ( $a as $b) and another foreach ($c as $d => $e). How do i combine them to read as one. I tired foreach (($a as $b) && ($c as $d => $e)), but that is rubbish.

                  推荐答案

                  您可能对 SPL 的 MultipleIterator

                  例如

                  // ArrayIterator is just an example, could be any Iterator.
                  $a1 = new ArrayIterator(array(1, 2, 3, 4, 5, 6));
                  $a2 = new ArrayIterator(array(11, 12, 13, 14, 15, 16));
                  
                  $it = new MultipleIterator;
                  $it->attachIterator($a1);
                  $it->attachIterator($a2);
                  
                  foreach($it as $e) {
                    echo $e[0], ' | ', $e[1], "
                  ";
                  }
                  

                  印刷品

                  1 | 11
                  2 | 12
                  3 | 13
                  4 | 14
                  5 | 15
                  6 | 16
                  

                  这篇关于如何将两个 foreach 循环合二为一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PHP foreach 只返回键 下一篇:php使用foreach将值插入数组中

                  相关文章

                  最新文章

                  1. <i id='SR6mF'><tr id='SR6mF'><dt id='SR6mF'><q id='SR6mF'><span id='SR6mF'><b id='SR6mF'><form id='SR6mF'><ins id='SR6mF'></ins><ul id='SR6mF'></ul><sub id='SR6mF'></sub></form><legend id='SR6mF'></legend><bdo id='SR6mF'><pre id='SR6mF'><center id='SR6mF'></center></pre></bdo></b><th id='SR6mF'></th></span></q></dt></tr></i><div id='SR6mF'><tfoot id='SR6mF'></tfoot><dl id='SR6mF'><fieldset id='SR6mF'></fieldset></dl></div>

                    <small id='SR6mF'></small><noframes id='SR6mF'>

                    • <bdo id='SR6mF'></bdo><ul id='SR6mF'></ul>
                  2. <tfoot id='SR6mF'></tfoot>

                    <legend id='SR6mF'><style id='SR6mF'><dir id='SR6mF'><q id='SR6mF'></q></dir></style></legend>