Remove key from array if key is in another array
I have two arrays
array1 (
"akey1" => "dfksjhf"
"akey2" => "adasjkgffs"
"akey3" => "afkjhsafshfkah"
)
array2 (
"akey2" => "could be anything..."
)
I am looking for a PHP function in which I can provide two arrays and the following will happen:
If both arrays have an identical key (regardless of data), then remove the key from array 1 and return the rest of array 1.
The if run function will return:
array3 (
"akey1" => "dfksjhf"
"akey3" => "afkjhsafshfkah"
)
Is there a PHP function that can do this already, and if not what would be the fastest and most efficient way to execute this function in PHP?
Many thanks