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

  • <small id='YiN79'></small><noframes id='YiN79'>

      1. 在 PHP 中获取和删除数组的第一个元素

        Get and remove first element of an array in PHP(在 PHP 中获取和删除数组的第一个元素)

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

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

            1. <legend id='s3sl1'><style id='s3sl1'><dir id='s3sl1'><q id='s3sl1'></q></dir></style></legend>
            2. <tfoot id='s3sl1'></tfoot>
                <bdo id='s3sl1'></bdo><ul id='s3sl1'></ul>

                  本文介绍了在 PHP 中获取和删除数组的第一个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在编写一个系统,我需要一个函数来获取和删除数组的第一个元素.这个数组有数字,即

                  Hi I am coding a system in which I need a function to get and remove the first element of the array. This array has numbers i.e.

                  0,1,2,3,4,5

                  0,1,2,3,4,5

                  我如何遍历这个数组并在每次传递时获取值,然后将其从数组中删除,以便在 5 轮结束时数组将为空.

                  how can I loop through this array and with each pass get the value and then remove that from the array so at the end of 5 rounds the array will be empty.

                  提前致谢

                  推荐答案

                  您可以尝试使用 foreach/unset,而不是 array_shift.

                  You might try using foreach/unset, instead of array_shift.

                  $array = array(0, 1, 2, 3, 4, 5);
                  
                  foreach($array as $value)
                  {
                      // with each pass get the value
                      // use method to doSomethingWithValue($value);
                      echo $value;
                      // and then remove that from the array 
                      unset($array[$value]);
                  }
                  //so at the end of 6 rounds the array will be empty
                  assert('empty($array) /* Array must be empty. */');
                  ?>
                  

                  这篇关于在 PHP 中获取和删除数组的第一个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                  <tfoot id='Uhw4S'></tfoot>

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

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

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