<tfoot id='v3vHe'></tfoot>

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

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

        合并2个多维数组并求和

        Merge 2 multi-dimension arrays and sum value(合并2个多维数组并求和)
          <bdo id='dLmj7'></bdo><ul id='dLmj7'></ul>

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

                <tbody id='dLmj7'></tbody>

              <tfoot id='dLmj7'></tfoot>

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

                • 本文介绍了合并2个多维数组并求和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有两个存储 x 和 y 坐标的多维数组,我试图将它们合并到一个数组中,同时保留 x 值但将 y 值相加.

                  I have two multidimensional arrays which store x and y coordinates I am trying to merge together into a single array while preserving the x value but adding together the y values.

                  数组 1:

                  Array(
                  [0] => Array
                      (
                          [x] => 1327449600000
                          [y] => 5
                      )
                  
                  [1] => Array
                      (
                          [x] => 1327450500000
                          [y] => 1
                      )
                  

                  数组 2:

                   Array(
                  [0] => Array
                      (
                          [x] => 1327449600000
                          [y] => 1
                      )
                  
                  [1] => Array
                      (
                          [x] => 1327450500000
                          [y] => 3
                      )
                  

                  所以综合结果是:

                   Array(
                  [0] => Array
                      (
                          [x] => 1327449600000
                          [y] => 6
                      )
                  
                  [1] => Array
                      (
                          [x] => 1327450500000
                          [y] => 4
                      )
                  

                  任何帮助将不胜感激.

                  推荐答案

                  function add_array($a1, $a2) {
                      $c = count($a1);
                      for ($i=0;$i<$c;$i++) {
                          if (isset($a2[$i]) && isset($a2[$i]['y'])) {
                              $a1[$i]['y'] += $a2[$i]['y'];
                          }
                      }
                      return $a1;
                  }
                  

                  这篇关于合并2个多维数组并求和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  PHP Upload File Validation(PHP 上传文件验证)
                  PHP Error - Uploading a file(PHP 错误 - 上传文件)
                  How can I write tests for file upload in PHP?(如何在 PHP 中编写文件上传测试?)
                  php resizing image on upload rotates the image when i don#39;t want it to(php在上传时调整图像大小会在我不想要它时旋转图像)
                  How to send additional data using PLupload?(如何使用 PLupload 发送附加数据?)
                  change button text in js/ajax after mp4 =gt;mp3 conversion in php(在 php 中的 mp4 =gt;mp3 转换后更改 js/ajax 中的按钮文本)
                      <tbody id='lJZsv'></tbody>
                  1. <small id='lJZsv'></small><noframes id='lJZsv'>

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

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

                            <tfoot id='lJZsv'></tfoot>