skip to Main Content

Php – Why doesn't array_diff() work straight away with an array of enums, whereas in_array() or array_udiff() do?

Using PHP 8.4, given the following functions: function test_array_diff($all, $filtered) { return array_diff($all, $filtered); } function test_array_udiff($all, $filtered) { return array_udiff($all, $filtered, fn($item1, $item2) => $item1 != $item2); } function test_in_array($all, $filtered) { $diff = []; foreach ($all as $case)…

VIEW QUESTION
Back To Top
Search