[doc-en] master: array_unique: explain what the 7.2 rebuild actually changes (#5825)

From: Date: Wed, 02 Sep 2026 14:39:48 +0000
Subject: [doc-en] master: array_unique: explain what the 7.2 rebuild actually changes (#5825)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23702@lists.php.net to get a copy of this message
Author: Louis-Arnaud (lacatoire) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-09-02T16:39:45+02:00 Commit: https://github.com/php/doc-en/commit/5e26d11dc3f606b25c95467df22f9469636781f9 Raw diff: https://github.com/php/doc-en/commit/5e26d11dc3f606b25c95467df22f9469636781f9.diff array_unique: explain what the 7.2 rebuild actually changes (#5825) The 7.2.0 entry mentioned array packing, an engine detail, and left 'different numeric indexes' unexplained. The keys of the returned elements are unchanged; what differs is the index generated when an element is appended afterwards, and only when the element carrying the largest integer key was among the removed duplicates. The 7.2 migration guide carried the same sentence and is updated too. Changed paths: M appendices/migration72/incompatible.xml M reference/array/functions/array-unique.xml Diff: diff --git a/appendices/migration72/incompatible.xml b/appendices/migration72/incompatible.xml index 725d7d032cfc..d936d832155f 100644 --- a/appendices/migration72/incompatible.xml +++ b/appendices/migration72/incompatible.xml @@ -269,12 +269,16 @@ int(2) <sect2 xml:id="migration72.incompatible.array-unique"> <title><function>array_unique</function> with <constant>SORT_STRING</constant></title> - <para> - While <function>array_unique</function> with <constant>SORT_STRING</constant> - formerly copied the array and removed non-unique elements (without packing - the array afterwards), now a new array is built by adding the - unique elements. This can result in different numeric indexes. - </para> + <simpara> + <function>array_unique</function> with <constant>SORT_STRING</constant> + builds the returned array by adding the unique elements to a new array; + formerly, it was a copy of the input from which the non-unique elements + were removed. + Both hold the same elements under the same keys, but if the element with + the largest integer key is among those removed, the index generated for an + element appended to the returned array differs from the one the input + would have generated. + </simpara> </sect2> <sect2 xml:id="migration72.incompatible.bcmod-and-floats"> diff --git a/reference/array/functions/array-unique.xml b/reference/array/functions/array-unique.xml index 3bd1d0a6d2d2..3ab031463cea 100644 --- a/reference/array/functions/array-unique.xml +++ b/reference/array/functions/array-unique.xml @@ -108,10 +108,13 @@ <entry>7.2.0</entry> <entry> If <parameter>flags</parameter> is <constant>SORT_STRING</constant>, - formerly <parameter>array</parameter> has been copied and non-unique - elements have been removed (without packing the array afterwards), but - now a new array is built by adding the unique elements. This can result - in different numeric indexes. + the returned array is built by adding the unique elements to a new + array; formerly, it was a copy of <parameter>array</parameter> from + which the non-unique elements were removed. + Both hold the same elements under the same keys, but if the element + with the largest integer key is among those removed, the index + generated for an element appended to the returned array differs from + the one <parameter>array</parameter> would have generated. </entry> </row> </tbody>

« previous php.doc.cvs (#23702) next »