How can array_diff be used to compare two arrays in PHP?
To compare two arrays in PHP, you can use the array_diff function, which returns an array containing all the values from the first array that are not present in any of the other arrays passed as arguments. This allows you to easily identify the differences between two arrays.
```php
$array1 = [1, 2, 3, 4, 5];
$array2 = [2, 3, 4, 5, 6];
$diff = array_diff($array1, $array2);
print_r($diff);
```
In this example, the output will be:
```
Array
(
[0] => 1
)
```
This shows that the value 1 is present in $array1 but not in $array2.