How can the array_search() function be utilized to search for values in an array in PHP?

The array_search() function in PHP can be utilized to search for a specific value within an array and return the corresponding key if the value is found. This function is useful when you need to quickly check if a value exists in an array without iterating through the entire array manually. Example:

// Define an array to search
$fruits = array('apple', 'banana', 'orange', 'grape');

// Search for the value 'orange' in the array
$key = array_search('orange', $fruits);

if ($key !== false) {
    echo 'The key of "orange" in the array is: ' . $key;
} else {
    echo 'Value not found in the array.';
}