What are some potential pitfalls when using array_diff to compare arrays in PHP, as seen in the provided code snippet?

When using `array_diff` to compare arrays in PHP, one potential pitfall is that the function only compares values and not keys. This means that if the keys are important in your comparison, `array_diff` may not give you the desired result. To compare both keys and values, you can use `array_diff_assoc` instead.

$array1 = ['a' => 'apple', 'b' => 'banana', 'c' => 'cherry'];
$array2 = ['a' => 'apple', 'b' => 'banana'];

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

print_r($diff);