rfc:in_operator
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:in_operator [2015/02/19 23:56] – updated draft kelunik | rfc:in_operator [2015/02/20 12:50] – Under Discussion kelunik | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: In Operator ====== | ====== PHP RFC: In Operator ====== | ||
- | * Version: 0.2 | + | * Version: 0.3 |
* Date: 2015-02-20 | * Date: 2015-02-20 | ||
* Authors: Niklas Keller < | * Authors: Niklas Keller < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | This RFC adds a new '' | + | This RFC adds a new '' |
===== Proposal ===== | ===== Proposal ===== | ||
Add a new operator '' | Add a new operator '' | ||
- | It uses strict comparison ('' | + | It uses strict comparison ('' |
<code php> | <code php> | ||
Line 22: | Line 22: | ||
</ | </ | ||
- | If the first parameter is an array, it checks for every element whether it's contained in the '' | + | <code php> |
+ | function gen () { | ||
+ | yield " | ||
+ | yield " | ||
+ | } | ||
+ | |||
+ | $contains = " | ||
+ | </ | ||
+ | |||
+ | If the first parameter is an array , it checks for every element whether it's contained in the '' | ||
<code php> | <code php> | ||
Line 31: | Line 40: | ||
</ | </ | ||
- | For stings, it behaves exactly like '' | + | For strings, it behaves exactly like '' |
<code php> | <code php> | ||
$contains = " | $contains = " | ||
Line 38: | Line 47: | ||
Objects are not supported, because we already have '' | Objects are not supported, because we already have '' | ||
+ | |||
+ | ==== Why strict? ==== | ||
+ | It's strict because otherwise something like ''" | ||
+ | |||
+ | ==== Precedence ==== | ||
+ | It should have the same precedence as '' | ||
+ | |||
+ | <code php> | ||
+ | if (!$input in $validValues) { | ||
+ | // ... | ||
+ | } | ||
+ | </ | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | New reserved keyword '' | + | New reserved keyword '' |
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== |
rfc/in_operator.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1