Doc #62383 [NEW]: array_replace() arguments not passed by reference
| From: | confidential99 at gmail dot com | Date: | Thu, 21 Jun 2012 14:27:17 +0000 |
| Subject: | Doc #62383 [NEW]: array_replace() arguments not passed by reference | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-8489@lists.php.net to get a copy of this message | ||
From: confidential99 at gmail dot com
Operating system:
PHP version: Irrelevant
Package: Arrays related
Bug Type: Documentation Problem
Bug description:array_replace() arguments not passed by reference
Description:
------------
The document for the array_replace function says that "array_replace()
replaces the values of the first array with the same values from all the
following arrays...." The signature for the function indicates the arrays
will be passed by reference.
Test script:
---------------
<?php
$array1 =
array('AMZN'=>223.02,'BA'=>8.14,'SAN'=>6.26,'AAPL'=>586.05);
$array2 =
array('AMZN'=>223.84,'BA'=>8.11,'SAN'=>6.40,'FB'=>31.60,'ORCL'=>28.49);
$array3 =
array('AMZN'=>224.25,'BA'=>8.10,'ORCL'=>28.39,'INTC'=>27.38);
array_replace($array1,$array2,$array3);
var_dump($array1);
Expected result:
----------------
array(7) { ["AMZN"]=> float(224.25) ["BA"]=> float(8.1)
["SAN"]=>
float(6.4) ["AAPL"]=> float(586.05) ["FB"]=> float(31.6)
["ORCL"]=>
float(28.39) ["INTC"]=> float(27.38) }
Actual result:
--------------
array(4) { ["AMZN"]=> float(223.02) ["BA"]=> float(8.14)
["SAN"]=>
float(6.26) ["AAPL"]=> float(586.05) }
--
Edit bug report at https://bugs.php.net/bug.php?id=62383&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62383&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62383&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62383&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62383&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62383&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62383&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62383&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62383&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62383&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62383&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62383&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62383&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62383&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62383&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62383&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62383&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62383&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62383&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62383&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62383&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62383&r=mysqlcfg