PHP 比较数组 [英] PHP compare array
本文介绍了PHP 比较数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
无论如何,是否可以使用内置函数比较 php 中的数组,而不是执行某种循环?
Is there anyway to compare arrays in php using an inbuilt function, short of doing some sort of loop?
$a1 = array(1,2,3);
$a2 = array(1,2,3);
if (array_are_same($a1, $a2)) {
// code here
}
顺便说一句,数组值不会总是以相同的顺序排列.
Btw, the array values will not always be in the same order.
推荐答案
if ( $a == $b ) {
echo 'We are the same!';
}
这篇关于PHP 比较数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文