Doc #79402 [Fbk->NoF]: Description fix suggestion

From: Date: Sun, 05 Apr 2020 04:22:08 +0000
Subject: Doc #79402 [Fbk->NoF]: Description fix suggestion
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17461@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79402&edit=1 ID: 79402 Updated by: php-bugs@lists.php.net Reported by: simongcc at gmail dot com Summary: Description fix suggestion -Status: Feedback +Status: No Feedback Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant Assigned To: cmb Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2020-03-22 13:37:08] cmb@php.net Isn't that already sufficiently explained: | The + operator returns the right-hand array appended to the | left-hand array; for keys that exist in both arrays, the elements | from the left-hand array will be used, and the matching elements | from the right-hand array will be ignored. ------------------------------------------------------------------------ [2020-03-22 00:40:32] simongcc at gmail dot com Description: ------------ --- From manual page: https://php.net/language.operators.array --- It is only a problem in description. In the docs, it states that $a + $b is Union and it is Union of $a and $b. But it is not completely reflecting the characteristic of the Union in PHP. Since strictly speaking, an Union should be mutually inclusive of different things. In PHP, it is only an union of key regardless of value. So it should be written as Union of the key in $a and $b and based on $a or vice versa if it is $b + $a. (Because when there is/are key(s) exist(s) in the first variable, the same key(s) in the second variable will be ignored) Test script: --------------- $a = array('something' => 'interesting', 2); $b = array('another' => 'interesting thing', 0 => 3); $c = $a + $b; $d = $b + $a; print_r($c); print_r($d); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79402&edit=1

« previous php.doc.bugs (#17461) next »