Just today (01/23/2012), reading Habrahabr , the article I was somewhat discouraged. In addition, I noticed that, apparently, experienced programmers here, at HashCode "e also use the following design ( this question ):
foreach($m as &$a) { $a = iconv ('windows-1251', 'utf-8', $a); }
Firstly, it is not entirely clear why? As far as I remember, the following code in PHP will also be correct:
foreach($m as $a) { $a = iconv ('windows-1251', 'utf-8', $a); }
Secondly, from an article on Habré I did not understand how another programmer (for example, Petrovich) could somehow influence the variable &$a
, as in our case. Does the effect of this variable really apply to all further code in PHP? Those. scope is not limited to foreach
?
Thirdly, I would not, in such a simple example, especially as a beginner, give such a “subtlety” into service. For as it is said on the same Habré, even the "experienced", to some extent, programmers are confused with this now.