请教如何判断两个二维数组是否一样

WBOY
Release: 2016-06-13 12:26:07
Original
3023 people have browsed it

请问怎么判断两个二维数组是否一样
请问怎么判断两个二维数组是否一样
比如:
 
array(
       '0000-00'=>123,
       '0001-00'=>12,
       '0002-00'=>12,
)

array(
       '0000-00'=>123,
        '0002-00'=>12,
       '0001-00'=>12,
)
这两个一样的,请问怎么判断呢?
------解决思路----------------------
你这是一维数组,直接比较就可以

$a = array(<br />       '0000-00'=>123,<br />       '0001-00'=>12,<br />       '0002-00'=>12,<br />);<br /><br />$b = array(<br />       '0000-00'=>123,<br />        '0002-00'=>12,<br />       '0001-00'=>12,<br />);<br /><br />var_dump($a == $b);<br />
Copy after login
bool(true)

------解决思路----------------------
$a = array(
       '0000-00'=>array(123,345),
       '0001-00'=>array(123,345),
       '0002-00'=>array(123,345),
);
 
$b = array(
       '0000-00'=>array(123,345),
        '0002-00'=>array(123,345),
       '0001-00'=>array(123,345),
);
if($a===$b){
    echo '全等';
} else {
    echo '不全等';
}
------解决思路----------------------
$a = array(
       '0000-00'=>array(123,345),
       '0001-00'=>array(123,345),
       '0002-00'=>array(123,345),
);

$b = array(
       '0000-00'=>array(123,345),
        '0002-00'=>array(123,345),
       '0001-00'=>array(123,345),
);

var_dump($a==$b);

?>

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!