|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-04-06 21:18 UTC] jani@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Feb 12 10:00:02 2026 UTC |
Description: ------------ The example prints 9 as the value of $a , though it should be 8; The fact the referencing $a[0] causes $a[0] to become a reference itself , is dangerous in cases like this where it is possible to change the value of $a[0] though it was not originally defined as a reference. Reproduce code: --------------- function a($c){ $c[0] = 9; } $a[0] = 8; $c = &$a[0]; a($a); echo $a[0]; Expected result: ---------------- The value of $a should be 8 Actual result: -------------- The value printed is 9