note 124637 added to control-structures.foreach
| From: | dan@php.net | Date: | Thu, 23 Jan 2020 02:05:01 +0000 |
| Subject: | note 124637 added to control-structures.foreach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-213942@lists.php.net to get a copy of this message | ||
Having to unset the reference manually completely destroys the practicality of using a referenced
variable.
If you make the small mistake of forgetting/deleting the unset line your code might silently mix
data, the risk is too high for little gain.
If you need to reassign the value, it is way better to just use:
<?php
$array[$key] = $newvalue;
?>
----
Server IP: 45.112.84.4
Probable Submitter: 38.142.137.34 (proxied: 189.203.187.244)
----
Manual Page -- http://php.net/manual/en/control-structures.foreach.php
Edit -- https://master.php.net/note/edit/124637
Del: integrated -- https://master.php.net/note/delete/124637/integrated
Del: useless -- https://master.php.net/note/delete/124637/useless
Del: bad code -- https://master.php.net/note/delete/124637/bad+code
Del: spam -- https://master.php.net/note/delete/124637/spam
Del: non-english -- https://master.php.net/note/delete/124637/non-english
Del: in docs -- https://master.php.net/note/delete/124637/in+docs
Del: other reasons-- https://master.php.net/note/delete/124637
Reject -- https://master.php.net/note/reject/124637
Search -- https://master.php.net/manage/user-notes.php