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/20 00:51] – added traversable, precedence, strict kelunik | rfc:in_operator [2015/02/26 19:40] – kelunik | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: In Operator ====== | ====== PHP RFC: In Operator ====== | ||
- | * Version: 0.3 | + | * Version: 0.4 |
- | * Date: 2015-02-20 | + | * Date: 2015-02-26 |
* Authors: Niklas Keller < | * Authors: Niklas Keller < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 20: | Line 20: | ||
$contains = " | $contains = " | ||
$contains = 0 in [" | $contains = 0 in [" | ||
+ | |||
+ | $contains = [" | ||
+ | $contains = [" | ||
</ | </ | ||
+ | |||
+ | '' | ||
<code php> | <code php> | ||
Line 26: | Line 31: | ||
yield " | yield " | ||
yield " | yield " | ||
+ | // code below here wouldn' | ||
+ | // because it stops if there' | ||
} | } | ||
- | $contains = " | + | $contains = " |
+ | $contains = " | ||
</ | </ | ||
- | If the first parameter is an array , it checks for every element whether it's contained in the '' | + | If '' |
- | + | ||
- | <code php> | + | |
- | $contains = [" | + | |
- | $contains = [" | + | |
- | $contains = [[" | + | |
- | $contains = [[" | + | |
- | </ | + | |
- | + | ||
- | For strings, it behaves exactly like '' | + | |
<code php> | <code php> | ||
$contains = " | $contains = " | ||
$contains = " | $contains = " | ||
+ | $contains = 0 in " | ||
+ | $contains = 0 in 100; // true | ||
</ | </ | ||
- | Objects are not supported, because we already have '' | + | **Note**: This is a difference compared to '' |
+ | |||
+ | Other values than '' | ||
+ | |||
+ | If '' | ||
==== Why strict? ==== | ==== Why strict? ==== | ||
- | It's strict because otherwise something like ''" | + | It's strict because otherwise something like ''" |
==== Precedence ==== | ==== Precedence ==== | ||
Line 61: | Line 66: | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | New reserved keyword '' | + | New reserved keyword '' |
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
Line 71: | Line 76: | ||
===== Open Issues ===== | ===== Open Issues ===== | ||
- | Make sure there are no open issues when the vote starts! | + | None. |
===== Future Scope ===== | ===== Future Scope ===== | ||
- | None. | + | There could be a syntax that allows to check for multiple values at once, e.g. |
+ | <code php> | ||
+ | $contains = ...[" | ||
+ | </ | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
Line 80: | Line 88: | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
- | TBD | + | * https:// |
- | + | ||
- | ===== Implementation ===== | + | |
- | TBD | + | |
===== Rejected Features ===== | ===== Rejected Features ===== | ||
Keep this updated with features that were discussed on the mail lists. | Keep this updated with features that were discussed on the mail lists. | ||
+ | |||
+ | ===== Changelog ===== | ||
+ | * v0.4: Removed possibility to check multiple values using an array. |
rfc/in_operator.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1