|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-22 16:38 UTC] johannes@php.net
[2007-08-22 16:45 UTC] jw at coffeecup dot com
[2007-08-23 10:32 UTC] jani@php.net
[2007-11-21 17:28 UTC] vrana@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 06:00:01 2025 UTC |
Description: ------------ I get a syntax error when I cast the array_expression portion of a foreach loop to an array while using the & operator on the value portion. Reproduce code: --------------- $arr = array(1, 2, 3, 4); foreach ((array)$arr as &$value) { $value = $value * 2; } print_r($arr); Expected result: ---------------- Array ( [0] => 2 [1] => 4 [2] => 6 [3] => 8 ) Actual result: -------------- Parse error: syntax error, unexpected '&', expecting T_STRING or T_VARIABLE or '$'