Gets the difference between two array using their key for comparison calculation

array:difference_by_key(ARRAY $first_array, ARRAY $second_array) : ARRAY

$first_array = [
    1,2,3,4,5,6
]
$second_array = [
    1,2,3,4,5
]

array:difference_by_key($first_array, $second_array)
#=> [
#=>     5 => 6
#=> ]

#===
$first_array = [
    [1],[2]
]
$second_array = [
    [1]
]
array:difference_by_key($first_array, $second_array)
#=> [
#=>     1 => [
#=>         2
#=>     ]
#=> ]

Copyright ©2013-2022 SunSed®. All rights reserved.