久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='Nc6bP'><style id='Nc6bP'><dir id='Nc6bP'><q id='Nc6bP'></q></dir></style></legend>
      <bdo id='Nc6bP'></bdo><ul id='Nc6bP'></ul>
    <tfoot id='Nc6bP'></tfoot>

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

      1. <i id='Nc6bP'><tr id='Nc6bP'><dt id='Nc6bP'><q id='Nc6bP'><span id='Nc6bP'><b id='Nc6bP'><form id='Nc6bP'><ins id='Nc6bP'></ins><ul id='Nc6bP'></ul><sub id='Nc6bP'></sub></form><legend id='Nc6bP'></legend><bdo id='Nc6bP'><pre id='Nc6bP'><center id='Nc6bP'></center></pre></bdo></b><th id='Nc6bP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Nc6bP'><tfoot id='Nc6bP'></tfoot><dl id='Nc6bP'><fieldset id='Nc6bP'></fieldset></dl></div>
      2. 在 PHP 中使用 foreach 循環(huán)時(shí)查找數(shù)組的最后一個(gè)元

        Find the last element of an array while using a foreach loop in PHP(在 PHP 中使用 foreach 循環(huán)時(shí)查找數(shù)組的最后一個(gè)元素)

          <tfoot id='Jt12H'></tfoot>

          • <bdo id='Jt12H'></bdo><ul id='Jt12H'></ul>
              <i id='Jt12H'><tr id='Jt12H'><dt id='Jt12H'><q id='Jt12H'><span id='Jt12H'><b id='Jt12H'><form id='Jt12H'><ins id='Jt12H'></ins><ul id='Jt12H'></ul><sub id='Jt12H'></sub></form><legend id='Jt12H'></legend><bdo id='Jt12H'><pre id='Jt12H'><center id='Jt12H'></center></pre></bdo></b><th id='Jt12H'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Jt12H'><tfoot id='Jt12H'></tfoot><dl id='Jt12H'><fieldset id='Jt12H'></fieldset></dl></div>

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

              <legend id='Jt12H'><style id='Jt12H'><dir id='Jt12H'><q id='Jt12H'></q></dir></style></legend>
                    <tbody id='Jt12H'></tbody>
                  本文介紹了在 PHP 中使用 foreach 循環(huán)時(shí)查找數(shù)組的最后一個(gè)元素的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在使用一些參數(shù)編寫 SQL 查詢創(chuàng)建器.在 Java 中,只需通過數(shù)組長(zhǎng)度檢查當(dāng)前數(shù)組位置,就可以很容易地從 for 循環(huán)內(nèi)部檢測(cè)數(shù)組的最后一個(gè)元素.

                  I am writing a SQL query creator using some parameters. In Java, it's very easy to detect the last element of an array from inside the for loop by just checking the current array position with the array length.

                  for(int i=0; i< arr.length;i++){
                       boolean isLastElem = i== (arr.length -1) ? true : false;        
                  }
                  

                  在 PHP 中,它們有非整數(shù)索引來訪問數(shù)組.因此,您必須使用 foreach 循環(huán)遍歷數(shù)組.當(dāng)您需要做出一些決定(在我的情況下,在構(gòu)建查詢時(shí)附加或/和參數(shù))時(shí),這會(huì)成為問題.

                  In PHP they have non-integer indexes to access arrays. So you must iterate over an array using a foreach loop. This becomes problematic when you need to take some decision (in my case to append or/and parameter while building query).

                  我相信一定有一些標(biāo)準(zhǔn)的方法可以做到這一點(diǎn).

                  I am sure there must be some standard way of doing this.

                  你如何在 PHP 中解決這個(gè)問題?

                  How do you solve this in PHP?

                  推薦答案

                  聽起來你想要這樣的東西:

                  It sounds like you want something like this:

                  $numItems = count($arr);
                  $i = 0;
                  foreach($arr as $key=>$value) {
                    if(++$i === $numItems) {
                      echo "last index!";
                    }
                  }    
                  

                  話雖如此,您不必在 php 中使用 foreach 迭代數(shù)組".

                  That being said, you don't -have- to iterate over an "array" using foreach in php.

                  這篇關(guān)于在 PHP 中使用 foreach 循環(huán)時(shí)查找數(shù)組的最后一個(gè)元素的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準(zhǔn)備好的語句amp;foreach 循環(huán))
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個(gè)服務(wù)器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識(shí)別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個(gè)參數(shù))
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結(jié)果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“l(fā)ocalhost的訪問被拒絕)
                • <i id='QEz5z'><tr id='QEz5z'><dt id='QEz5z'><q id='QEz5z'><span id='QEz5z'><b id='QEz5z'><form id='QEz5z'><ins id='QEz5z'></ins><ul id='QEz5z'></ul><sub id='QEz5z'></sub></form><legend id='QEz5z'></legend><bdo id='QEz5z'><pre id='QEz5z'><center id='QEz5z'></center></pre></bdo></b><th id='QEz5z'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='QEz5z'><tfoot id='QEz5z'></tfoot><dl id='QEz5z'><fieldset id='QEz5z'></fieldset></dl></div>
                • <legend id='QEz5z'><style id='QEz5z'><dir id='QEz5z'><q id='QEz5z'></q></dir></style></legend><tfoot id='QEz5z'></tfoot>
                    <bdo id='QEz5z'></bdo><ul id='QEz5z'></ul>

                        <tbody id='QEz5z'></tbody>

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

                            主站蜘蛛池模板: 天天干天天玩天天操 | 日韩成人免费av | 亚洲视频一区在线 | 亚洲精品在线免费 | 亚洲免费在线 | 婷婷久 | 狠狠草视频 | 久热精品在线 | 成人午夜在线 | 亚洲一区中文字幕 | 精品中文字幕一区二区 | www国产精品| 国产精品精品视频一区二区三区 | 一区二区视频在线观看 | 久久成人18免费网站 | 亚洲精品第一 | 国产午夜精品一区二区 | 日韩亚洲视频在线 | 一级做受毛片免费大片 | 日韩免费网站 | 成人二区 | 亚洲精品国产综合区久久久久久久 | 四虎永久在线精品免费一区二 | 91国产视频在线观看 | 久久久久久久久99精品 | 成人精品免费 | 三级成人在线 | 五月婷婷激情 | 日韩精品在线观看一区二区 | 精品视频在线播放 | 国产精品一区二区视频 | 欧美一区视频在线 | 岛国毛片 | 国产不卡一 | 国产在线精品一区 | 国产亚洲精品一区二区三区 | 黄网站涩免费蜜桃网站 | 日本一区二区高清不卡 | 日韩欧美大片在线观看 | 爱草视频| 日本免费一区二区三区视频 |