note 79527 added to control-structures.foreach
| From: | egingell at sisna dot com | Date: | Sun, 02 Dec 2007 11:41:56 +0000 |
| Subject: | note 79527 added to control-structures.foreach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132730@lists.php.net to get a copy of this message | ||
> michpio at gazeta dot pl
> 20-Nov-2007 07:53
> Because in PHP >= 5.0 arrays are always transferred by reference.
No, they're not.
I'm running PHP v5.2.3
<?
function whatever($ary) {
$ary[] = 'blah';
}
$array = array();
whatever($array);
print_r($array);
?>
Assuming your claim is true, this should be output:
Array
(
0 => 'blah',
)
However, the actual output is this:
Array
(
)
----
Server IP: 209.41.74.194
Probable Submitter: 207.224.195.213
----
Manual Page -- http://www.php.net/manual/en/control-structures.foreach.php
Edit -- https://master.php.net/note/edit/79527
Del: integrated -- https://master.php.net/note/delete/79527/integrated
Del: useless -- https://master.php.net/note/delete/79527/useless
Del: bad code -- https://master.php.net/note/delete/79527/bad+code
Del: spam -- https://master.php.net/note/delete/79527/spam
Del: non-english -- https://master.php.net/note/delete/79527/non-english
Del: in docs -- https://master.php.net/note/delete/79527/in+docs
Del: other reasons-- https://master.php.net/note/delete/79527
Reject -- https://master.php.net/note/reject/79527
Search -- https://master.php.net/manage/user-notes.php