How can you check if a specific attribute exists in an array in PHP?

To check if a specific attribute exists in an array in PHP, you can use the `array_key_exists()` function. This function takes two parameters: the key you want to check for and the array you want to search in. If the key exists in the array, the function will return true, otherwise it will return false.

// Sample array
$array = array(
    'name' => 'John',
    'age' => 30,
    'city' => 'New York'
);

// Check if 'age' attribute exists in the array
if(array_key_exists('age', $array)) {
    echo 'The attribute "age" exists in the array.';
} else {
    echo 'The attribute "age" does not exist in the array.';
}