What is the difference between array_keys() and array_intersect() when checking for specific keys in an array in PHP?

When checking for specific keys in an array in PHP, `array_keys()` is used to retrieve all the keys of an array, while `array_intersect()` is used to find the intersection of arrays based on their keys. If you want to check if specific keys exist in an array, you should use `array_keys()` to get the keys of the array and then use `array_intersect()` to compare them with the keys you are looking for.

// Sample array
$array = ['a' => 1, 'b' => 2, 'c' => 3];

// Keys to check
$keysToCheck = ['a', 'c'];

// Get the keys of the array
$allKeys = array_keys($array);

// Find the intersection of keys
$commonKeys = array_intersect($allKeys, $keysToCheck);

// Check if all keys are present
if(count($commonKeys) == count($keysToCheck)) {
    echo "All keys are present in the array";
} else {
    echo "Not all keys are present in the array";
}