What is the function array_diff in PHP used for?

The function array_diff in PHP is used to compare two or more arrays and return the values that are present in the first array but not in the other arrays. This can be useful when you need to find the differences between arrays or filter out common elements.

```php
$array1 = [1, 2, 3, 4, 5];
$array2 = [3, 4, 5, 6, 7];
$array_diff = array_diff($array1, $array2);

print_r($array_diff);
```

In this code snippet, the array_diff function is used to compare $array1 and $array2, and it will return an array containing the values [1, 2] which are present in $array1 but not in $array2.