On 23/10/2013 19:03, Matthew Leverton wrote:
Seems like a natural fit to me.
Does it also work with the new foreach/list combo?
foreach ($array as list(&$a, $b)) {}
Seems like a natural fit to me.
Does it also work with the new foreach/list combo?
foreach ($array as list(&$a, $b)) {}
ajf@raspberrypi ~/PHP/php-src $ sapi/cli/php -r '$arr = [[1,2],[3,4]];
foreach ($arr as list(&$a, $b)) $a = 7; var_dump($arr);'
array(2) {
[0]=>
array(2) {
[0]=>
int(7)
[1]=>
int(2)
}
[1]=>
array(2) {
[0]=>
&int(7)
[1]=>
int(4)
}
}
I should probably add a test for this.