|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-06-22 10:53 UTC] fd@php.net
[2012-06-22 19:36 UTC] crmalibu at gmail dot com
[2012-06-22 21:42 UTC] salathe@php.net
[2012-06-22 21:46 UTC] salathe@php.net
[2012-06-22 21:46 UTC] salathe@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: salathe
[2012-06-22 21:47 UTC] salathe@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 00:00:02 2025 UTC |
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) }