<?php
var_export([
// string, then times
'0:1' => str_repeat(0, 1), // '0'
'1:0' => str_repeat(1, 0), // ''
'0:0' => str_repeat(0, 0), // ''
'1:1' => str_repeat(1, 1), // '1'
]);
echo "\n---\n";
$params = [
['one' => 0, 'two' => 1, 'three' => 0, 'four' => 1], // strings
['three' => 0, 'one' => 1, 'four' => 1, 'two' => 0], // times
'str_repeat'
];
var_export([
'udiff' => array_udiff_assoc(...$params),
'uintersect' => array_uintersect_assoc(...$params),
]);
- Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- array (
'0:1' => '0',
'1:0' => '',
'0:0' => '',
'1:1' => '1',
)
---
array (
'udiff' =>
array (
'four' => 1,
),
'uintersect' =>
array (
'one' => 0,
'two' => 1,
'three' => 0,
),
)
preferences:
117.35 ms | 407 KiB | 5 Q