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

php数组找数有关问题

WBOY
Release: 2016-06-13 13:17:31
Original
808 people have browsed it

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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template