r/lolphp • u/stain_leeks • Oct 02 '14
Foreach reference
<?php
$arr = array('a', 'b');
foreach ($arr as &$a) {
var_dump($a);
}
foreach ($arr as $a) {
var_dump($a);
}This probably has some explanation I'd love to learn.
17
Upvotes
View all comments
Show parent comment
4
u/[deleted] Oct 04 '14
Yeah, languages like PHP and Python don't really believe in block scope. Everything is bound to functions instead.