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

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

      <tfoot id='npP63'></tfoot>

    1. <small id='npP63'></small><noframes id='npP63'>

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

        php从数组中删除重复项

        php remove duplicates from array(php从数组中删除重复项)

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

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

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

                  <bdo id='euyQt'></bdo><ul id='euyQt'></ul>
                  <tfoot id='euyQt'></tfoot>
                  本文介绍了php从数组中删除重复项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想知道是否有人可以帮助我,我正在尝试找到一个脚本来检查我的整个数组并在需要时删除任何重复项,然后以相同的格式输出数组.

                  I was wondering if anyone could help me out, I'm trying to find a script that will check my entire array and remove any duplicates if required, then spit out the array in the same format.

                  这是我的数组的一个例子(你会看到有一些重复):

                  Here's an example of my array (as you will see there are some duplicates):

                  Array
                  (
                      [0] => Array
                          (
                              [0] => stdClass Object
                                  (
                                      [bid] => 34
                                      [name] => Adrianos Pizza & Pasta
                                      [imageurl] => sp_adrian.gif
                                      [clickurl] => #
                                  )
                  
                              [1] => stdClass Object
                                  (
                                      [bid] => 42
                                      [name] => Ray White Mordialloc
                                      [imageurl] => sp_raywhite.gif
                                      [clickurl] => http://www.raywhite.com/
                                  )
                  
                              [2] => stdClass Object
                                  (
                                      [bid] => 48
                                      [name] => Beachside Osteo
                                      [imageurl] => sp_beachside.gif
                                      [clickurl] => http://www.beachsideosteo.com.au/
                                  )
                  
                              [3] => stdClass Object
                                  (
                                      [bid] => 57
                                      [name] => Southern Suburbs Physiotherapy Centre
                                      [imageurl] => sp_sspc.jpg
                                      [clickurl] => http://www.sspc.com.au
                                  )
                  
                              [4] => stdClass Object
                                  (
                                      [bid] => 52
                                      [name] => Mordialloc Travel and Cruise
                                      [imageurl] => sp_morditravel.jpg
                                      [clickurl] => http://www.yellowpages.com.au/vic/mordialloc/mordialloc-travel-cruise-13492525-listing.html
                                  )
                  
                              [5] => stdClass Object
                                  (
                                      [bid] => 37
                                      [name] => Mordialloc Cellar Door
                                      [imageurl] => sp_cellardoor.gif
                                      [clickurl] => 
                                  )
                  
                              [6] => stdClass Object
                                  (
                                      [bid] => 53
                                      [name] => Carmotive
                                      [imageurl] => sp_carmotive.jpg
                                      [clickurl] => http://www.carmotive.com.au/
                                  )
                  
                          )
                  
                      [1] => Array
                          (
                              [0] => stdClass Object
                                  (
                                      [bid] => 55
                                      [name] => 360South
                                      [imageurl] => sp_360.jpg
                                      [clickurl] => 
                                  )
                  
                              [1] => stdClass Object
                                  (
                                      [bid] => 40
                                      [name] => Ripponlea Mitsubishi
                                      [imageurl] => sp_mitsubishi.gif
                                      [clickurl] => 
                                  )
                  
                              [2] => stdClass Object
                                  (
                                      [bid] => 57
                                      [name] => Southern Suburbs Physiotherapy Centre
                                      [imageurl] => sp_sspc.jpg
                                      [clickurl] => http://www.sspc.com.au
                                  )
                  
                              [3] => stdClass Object
                                  (
                                      [bid] => 52
                                      [name] => Mordialloc Travel and Cruise
                                      [imageurl] => sp_morditravel.jpg
                                      [clickurl] => http://www.yellowpages.com.au/vic/mordialloc/mordialloc-travel-cruise-13492525-listing.html
                                  )
                  
                              [4] => stdClass Object
                                  (
                                      [bid] => 37
                                      [name] => Mordialloc Cellar Door
                                      [imageurl] => sp_cellardoor.gif
                                      [clickurl] => 
                                  )
                  
                              [5] => stdClass Object
                                  (
                                      [bid] => 53
                                      [name] => Carmotive
                                      [imageurl] => sp_carmotive.jpg
                                      [clickurl] => http://www.carmotive.com.au/
                                  )
                  
                          )
                  
                      [2] => Array
                          (
                              [0] => stdClass Object
                                  (
                                      [bid] => 44
                                      [name] => Mordialloc Personal Trainers
                                      [imageurl] => sp_mordipt.gif
                                      [clickurl] => #
                                  )
                  
                              [1] => stdClass Object
                                  (
                                      [bid] => 36
                                      [name] => Big River
                                      [imageurl] => sp_bigriver.gif
                                      [clickurl] => 
                                  )
                  
                              [2] => stdClass Object
                                  (
                                      [bid] => 52
                                      [name] => Mordialloc Travel and Cruise
                                      [imageurl] => sp_morditravel.jpg
                                      [clickurl] => http://www.yellowpages.com.au/vic/mordialloc/mordialloc-travel-cruise-13492525-listing.html
                                  )
                  
                              [3] => stdClass Object
                                  (
                                      [bid] => 37
                                      [name] => Mordialloc Cellar Door
                                      [imageurl] => sp_cellardoor.gif
                                      [clickurl] => 
                                  )
                  
                              [4] => stdClass Object
                                  (
                                      [bid] => 53
                                      [name] => Carmotive
                                      [imageurl] => sp_carmotive.jpg
                                      [clickurl] => http://www.carmotive.com.au/
                                  )
                  
                          )
                  
                      [3] => Array
                          (
                              [0] => stdClass Object
                                  (
                                      [bid] => 41
                                      [name] => Print House Graphics
                                      [imageurl] => sp_printhouse.gif
                                      [clickurl] => 
                                  )
                  
                              [1] => stdClass Object
                                  (
                                      [bid] => 49
                                      [name] => Kim Reed Conveyancing
                                      [imageurl] => sp_kimreed.jpg
                                      [clickurl] => 
                                  )
                  
                              [2] => stdClass Object
                                  (
                                      [bid] => 37
                                      [name] => Mordialloc Cellar Door
                                      [imageurl] => sp_cellardoor.gif
                                      [clickurl] => 
                                  )
                  
                              [3] => stdClass Object
                                  (
                                      [bid] => 53
                                      [name] => Carmotive
                                      [imageurl] => sp_carmotive.jpg
                                      [clickurl] => http://www.carmotive.com.au/
                                  )
                  
                          )
                  
                      [4] => Array
                          (
                              [0] => stdClass Object
                                  (
                                      [bid] => 38
                                      [name] => Lowe Financial Group
                                      [imageurl] => sp_lowe.gif
                                      [clickurl] => http://lowefinancial.com/
                                  )
                  
                              [1] => stdClass Object
                                  (
                                      [bid] => 58
                                      [name] => Dicount Lollie Shop
                                      [imageurl] => new dls logo.jpg
                                      [clickurl] => 
                                  )
                  
                              [2] => stdClass Object
                                  (
                                      [bid] => 53
                                      [name] => Carmotive
                                      [imageurl] => sp_carmotive.jpg
                                      [clickurl] => http://www.carmotive.com.au/
                                  )
                  
                          )
                  
                      [5] => Array
                          (
                              [0] => stdClass Object
                                  (
                                      [bid] => 45
                                      [name] => Mordialloc Sporting Club
                                      [imageurl] => msc logo.jpg
                                      [clickurl] => 
                                  )
                  
                              [1] => stdClass Object
                                  (
                                      [bid] => 33
                                      [name] => Two Brothers
                                      [imageurl] => sp_2brothers.gif
                                      [clickurl] => http://www.2brothers.com.au/
                                  )
                  
                          )
                  
                      [6] => Array
                          (
                              [0] => stdClass Object
                                  (
                                      [bid] => 46
                                      [name] => Patterson Securities
                                      [imageurl] => cmyk patersons_withtag.jpg
                                      [clickurl] => 
                                  )
                  
                              [1] => stdClass Object
                                  (
                                      [bid] => 56
                                      [name] => Logical Services
                                      [imageurl] => sp_logical.jpg
                                      [clickurl] => 
                                  )
                  
                          )
                  
                      [7] => Array
                          (
                              [0] => stdClass Object
                                  (
                                      [bid] => 59
                                      [name] => Pure Sport
                                      [imageurl] => sp_psport.jpg
                                      [clickurl] => http://www.puresport.com.au/
                                  )
                  
                              [1] => stdClass Object
                                  (
                                      [bid] => 51
                                      [name] => Richmond and Bennison
                                      [imageurl] => sp_richmond.jpg
                                      [clickurl] => http://www.richbenn.com.au/
                                  )
                  
                          )
                  
                      [8] => Array
                          (
                              [0] => stdClass Object
                                  (
                                      [bid] => 39
                                      [name] => Main Street Mordialloc
                                      [imageurl] => main street cafe.jpg
                                      [clickurl] => 
                                  )
                  
                              [1] => stdClass Object
                                  (
                                      [bid] => 50
                                      [name] => Letec
                                      [imageurl] => sp_letec.jpg
                                      [clickurl] => www.letec.biz
                                  )
                  
                          )
                  
                      [9] => Array
                          (
                              [0] => stdClass Object
                                  (
                                      [bid] => 54
                                      [name] => PPM Builders
                                      [imageurl] => sp_ppm.jpg
                                      [clickurl] => http://www.hotfrog.com.au/Companies/P-P-M-Builders
                                  )
                  
                              [1] => stdClass Object
                                  (
                                      [bid] => 43
                                      [name] => Systema
                                      [imageurl] => sp_systema.gif
                                      [clickurl] => 
                                  )
                  
                          )
                  
                  )
                  

                  推荐答案

                  使用 array_unique 函数.

                  Use the array_unique function.

                  这是一个多维array_unique函数的实现.

                  Here is an implentation of a multi-dimensional array_unique function.

                  function super_unique($array)
                  {
                    $result = array_map("unserialize", array_unique(array_map("serialize", $array)));
                  
                    foreach ($result as $key => $value)
                    {
                      if ( is_array($value) )
                      {
                        $result[$key] = super_unique($value);
                      }
                    }
                  
                    return $result;
                  }
                  

                  未测试,来自功能手册中的注释.

                  Not tested, from the comments in the function manual.

                  这篇关于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 的问题)
                • <i id='AiQGu'><tr id='AiQGu'><dt id='AiQGu'><q id='AiQGu'><span id='AiQGu'><b id='AiQGu'><form id='AiQGu'><ins id='AiQGu'></ins><ul id='AiQGu'></ul><sub id='AiQGu'></sub></form><legend id='AiQGu'></legend><bdo id='AiQGu'><pre id='AiQGu'><center id='AiQGu'></center></pre></bdo></b><th id='AiQGu'></th></span></q></dt></tr></i><div id='AiQGu'><tfoot id='AiQGu'></tfoot><dl id='AiQGu'><fieldset id='AiQGu'></fieldset></dl></div>

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

                        <tfoot id='AiQGu'></tfoot>

                          • <legend id='AiQGu'><style id='AiQGu'><dir id='AiQGu'><q id='AiQGu'></q></dir></style></legend>
                              <tbody id='AiQGu'></tbody>

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