summaryrefslogtreecommitdiff
path: root/UPGRADING
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-09-08 15:14:48 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-09-09 11:03:17 +0200
commit73ab7b30ca52a49fb11b2d61fc757c8eeb7137fd (patch)
tree89669b47aaa31a1260cb77adfea7b15999587446 /UPGRADING
parent9975986b7ef849c3a8e73a48748befbfdc50e416 (diff)
downloadphp-git-73ab7b30ca52a49fb11b2d61fc757c8eeb7137fd.tar.gz
Allow array_diff() and array_intersect() with single array argument
Both of these functions are well-defined when used with a single array argument -- rejecting this case was an artificial limitation. This is not useful when called with explicit arguments, but removes edge-cases when used with argument unpacking: // OK even if $excludes is empty. array_diff($array, ...$excludes); // OK even if $arrays contains a single array only. array_intersect(...$arrays); This matches the behavior of functions like array_merge() and array_push(), which also allow calls with no array or a single array respectively. Closes GH-6097.
Diffstat (limited to 'UPGRADING')
-rw-r--r--UPGRADING8
1 files changed, 8 insertions, 0 deletions
diff --git a/UPGRADING b/UPGRADING
index 3d37c2db25..f98ae50d1b 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -771,6 +771,14 @@ PHP 8.0 UPGRADE NOTES
. Sorting functions are now stable, which means that equal-comparing elements
will retain their original order.
RFC: https://wiki.php.net/rfc/stable_sorting
+ . array_diff(), array_intersect() and their variations can now be used with
+ a single array as argument. This means that usages like the following are
+ now possible:
+
+ // OK even if $excludes is empty.
+ array_diff($array, ...$excludes);
+ // OK even if $arrays only contains a single array.
+ array_intersect(...$arrays);
- Zip:
. Extension updated to version 1.19.0