What are common pitfalls when comparing values from two arrays in PHP?

When comparing values from two arrays in PHP, a common pitfall is assuming that using the `==` or `===` operators will work as expected. This is because these operators compare the values and keys of the arrays, which may not be what you want. To accurately compare the values in two arrays, you should use the `array_diff` function, which will return an array containing all the values that are present in the first array but not in the second array.

$array1 = [1, 2, 3, 4];
$array2 = [2, 3, 5];

$diff = array_diff($array1, $array2);

if (empty($diff)) {
    echo "Arrays are equal in values.";
} else {
    echo "Arrays are not equal in values.";
}