Watch out for this:
foreach ($somearray as &$i) {
// update some $i...
}
...
foreach ($somearray as $i) {
// last element of $somearray is mysteriously
overwritten!
}
Problem is $i contians reference to last element of
$somearray after the first foreach, and the second foreach
happily assigns to it!
----
Server IP: 212.24.129.51
Probable Submitter: 80.188.199.89
----
Manual Page -- http://www.php.net/manual/en/language.references.what
do.php
Edit -- https://master
.php.net/note/edit/78375
Del: integrated -- h
ttps://master.php.net/note/delete/78375/integrated
Del: useless -- http
s://master.php.net/note/delete/78375/useless
Del: bad code -- htt
ps://master.php.net/note/delete/78375/bad+code
Del: spam -- https:/
/master.php.net/note/delete/78375/spam
Del: non-english --
https://master.php.net/note/delete/78375/non-english
Del: in docs -- http
s://master.php.net/note/delete/78375/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78375
Reject -- https://mast
er.php.net/note/reject/78375
Search -- https://
master.php.net/manage/user-notes.php
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|