I want to remove one ore more array element using array_diff_key() with one specific key but the result is different
$a = [
['value' => 1, 'text' => '1 Hour'],
['value' => 12, 'text' => '12 Hour'],
['value' => 24, 'text' => '1 Day'],
];
$b = [
['value' => 12],
];
$c = array_diff_key($a, $b);
//print_r($c);
//return Array ( [1] => Array ( [value] => 12 [text] => 12 Hour ) [2] => Array ( [value] => 24 [text] => 1 Day ))
Expected result
Array (
[1] => Array (
[value] => 1
[text] => 1 Hour )
[2] => Array (
[value] => 24
[text] => 1 Day )
)
I can get expected result if I set text in $b but in this case I don't want to set text.
Where i'm doing wrong? other solution is wellcome.
Thanks in advance
PS: $b can be one or more element
$awhere the value matches that of the incoming array$b, right?$bis an array or just you want to search12intextkey ?