rfc:foreach_unwrap_ref

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
rfc:foreach_unwrap_ref [2021/08/13 13:11] nikicrfc:foreach_unwrap_ref [2021/08/26 13:44] nikic
Line 56: Line 56:
 ===== Proposal ===== ===== Proposal =====
  
-This RFC proposes to change the semantics of foreach by reference to unwrap the reference after the loop. This means that ''$value'' will still have the value of the last (visited) element, but will no longer be a reference to it.+This RFC proposes to change the semantics of foreach by reference to unwrap the reference after the loop. This means that ''$value'' will still have the value of the last (visited) element, but will no longer be a reference to it. This also applies if the loop is left using ''break'', ''continue'' or ''goto''.
  
 While PHP does not have a dedicated language construct for reference unwrapping, the operation is logically equivalent to: While PHP does not have a dedicated language construct for reference unwrapping, the operation is logically equivalent to:
rfc/foreach_unwrap_ref.txt · Last modified: 2021/11/14 17:10 by nikic