<?php
$first = [
'c' => 'd',
'm' => 'n',
];
$second = [
'C' => 'd', // first encounter, qualifying key, qualifying value (['c' => 'd'] is removed from result)
'c' => 'D', // doesn't matter
'm' => 'N', // first encounter, qualifying key, disqualifying value
'M' => 'n', // this should eliminate ['m' => 'n'], but doesn't get the chance
];
/* behavior discovered while crafting this answer:
* https://stackoverflow.com/a/70817582/2943403
*/
var_export(
array_diff_uassoc(
$first,
$second,
'strcasecmp'
)
); // removes first-occurring, case-insensitive key, case-sensitive value
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /in/GWoNH
function name: (null)
number of ops: 11
compiled vars: !0 = $first, !1 = $second
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
3 0 E > ASSIGN !0, <array>
8 1 ASSIGN !1, <array>
19 2 INIT_FCALL 'var_export'
20 3 INIT_FCALL 'array_diff_uassoc'
21 4 SEND_VAR !0
22 5 SEND_VAR !1
23 6 SEND_VAL 'strcasecmp'
7 DO_ICALL $4
8 SEND_VAR $4
9 DO_ICALL
25 10 > RETURN 1
Generated using Vulcan Logic Dumper, using php 8.0.0
preferences:
160.49 ms | 1398 KiB | 17 Q