How to determine if two arrays are different in php
First use the function "array_diff()" to obtain the difference between the two arrays. This function The function is to calculate the difference between two or more arrays, and then determine the difference between the two returned arrays. If it is not empty, the two arrays are not the same.
Code example:
$array_a = ['a', 'b', 'c', 'u']; $array_b = ['a', 'b', 'c']; $diff = array_diff($array_a, $array_b); var_dump($diff);
The output result is:
array(3=>'u')
Recommended tutorial: "PHP Tutorial》
The above is the detailed content of How to determine whether two arrays are different in php. For more information, please follow other related articles on the PHP Chinese website!