|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-06-19 07:57 UTC] xyzzxf_2013 at 163 dot com
-PHP Version: 7.2.31
+PHP Version: 7.3.4nts
[2020-06-19 07:57 UTC] xyzzxf_2013 at 163 dot com
[2020-06-19 08:02 UTC] stas@php.net
-Type: Security
+Type: Bug
[2020-06-19 08:08 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2020-06-19 08:08 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 05:00:01 2025 UTC |
Description: ------------ Reference value modification of element of array Test script: --------------- $a = ['23','25','26']; foreach ($a as &$v) { $v = $v+1; } function get_check_code($data) { foreach ($data as &$a) { $a = hexdec($a); } $sum = dechex(array_sum($data)); return substr($sum, -2); } var_dump($a); $b = get_check_code($a); $c = array_merge($a,[$b]); print_r($c); Expected result: ---------------- var_dump($a) output array(3) { [0] => int(24) [1] => int(26) [2] => int(27) } print_r($c) output Array ( [0] => 24 [1] => 26 [2] => 39 [3] => 71 ) Actual result: -------------- The expected result of print_r($c) is Array ( [0] => 24 [1] => 26 [2] => 27 [3] => 71 ) or Array ( [0] => 36 [1] => 38 [2] => 39 [3] => 71 )