[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-bugs
Subject:    [DOC-BUGS] [PHP-BUG] Doc #79402 [NEW]: Description fix suggestion
From:       "simongcc at gmail dot com"<php-bugs () lists ! php ! net>
Date:       2020-03-22 0:40:32
Message-ID: bug-79402 () bugs ! php ! net
[Download RAW message or body]

From:             simongcc at gmail dot com
Operating system: 
PHP version:      Irrelevant
Package:          Documentation problem
Bug Type:         Documentation Problem
Bug description:Description fix suggestion

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 bug report at https://bugs.php.net/bug.php?id=79402&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=79402&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=79402&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=79402&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=79402&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=79402&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=79402&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=79402&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=79402&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=79402&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=79402&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79402&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=79402&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=79402&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=79402&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=79402&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=79402&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=79402&r=mysqlcfg

-- 
PHP Documentation Bugs Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic