php 在没有合作伙伴的整数列表中查找数字

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 在没有合作伙伴的整数列表中查找数字相关的知识,希望对你有一定的参考价值。

<?php

$list = [1,2,3,4,5,2,3,4,5];

$total = 0;

foreach ($list as $cursor) {
  // note this is the binary xor operator, not the logical xor
  $total = $total ^ $cursor;
}

echo $total . PHP_EOL;  // 1

以上是关于php 在没有合作伙伴的整数列表中查找数字的主要内容,如果未能解决你的问题,请参考以下文章