|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-10-20 18:16 UTC] cataphract@php.net
-Status: Open
+Status: Not a bug
[2012-10-20 18:16 UTC] cataphract@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 07:00:01 2025 UTC |
Description: ------------ A variable which is an array pass to function as value but this variable behaves as pass by reference. Test script: --------------- /* * an argument $bar pass to function by value not by reference */ function foo($bar) { $bar[0] = 'error'; } /* * any array variable */ $bar[0] = 'OK'; print_r($bar); echo '<br />'; /* * it will causes an error in function foo() * create any reference to value of array */ $any_reference = & $bar[0]; /* * although the argument $bar pass to function by value * it behaves as argument $bar pass to funkction by reference */ foo($bar); print_r($bar); echo '<br />'; Expected result: ---------------- Array ( [0] => OK ) Actual result: -------------- Array ( [0] => error )