Home >Backend Development >PHP Tutorial > php数组找数有关问题

php数组找数有关问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 13:17:31840browse

php数组找数问题?
$str ="1,2,3,4,5,6,0",$str1 ="1,3,5"如何找出str1中没有的数啊如$str2 ="2,4,6,0"

------解决方案--------------------

PHP code

$diffArr=array_diff(explode(',',$str),explode(',',$str1));  //求差集
echo implode("," , $diffArr); //输出 <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn