rfc:in_operator
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:in_operator [2015/02/20 12:50] – Under Discussion kelunik | rfc:in_operator [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: In Operator ====== | ====== PHP RFC: In Operator ====== | ||
- | * Version: 0.3 | + | * Version: 0.5.1 |
- | * Date: 2015-02-20 | + | * Date: 2015-03-15 |
* 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 '' |
+ | |||
+ | ===== Motivation ===== | ||
+ | Checking if a specific input in an allowed range of value is a very common check in web application, | ||
===== Proposal ===== | ===== Proposal ===== | ||
Line 20: | Line 23: | ||
$contains = " | $contains = " | ||
$contains = 0 in [" | $contains = 0 in [" | ||
+ | |||
+ | $contains = [" | ||
+ | $contains = [" | ||
</ | </ | ||
+ | |||
+ | '' | ||
<code php> | <code php> | ||
Line 26: | Line 34: | ||
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 = " | ||
Line 46: | Line 49: | ||
</ | </ | ||
- | Objects are not supported, because we already have '' | + | Other expressions than '' |
==== Why strict? ==== | ==== Why strict? ==== | ||
- | It's strict because otherwise something like ''" | + | It's strict because otherwise something like ''" |
==== Precedence ==== | ==== Precedence ==== | ||
Line 61: | Line 64: | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | New reserved keyword '' | + | New reserved keyword '' |
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
Line 69: | Line 72: | ||
==== New Constants ==== | ==== New Constants ==== | ||
A '' | A '' | ||
- | |||
- | ===== Open Issues ===== | ||
- | Make sure there are no open issues when the vote starts! | ||
===== 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 | + | ===== Votes ===== |
- | Requires a 2/3 majority, | + | Requires a 2/3 majority. Even if it passes, it will //only// get merged if the [[rfc/ |
- | ===== Patches and Tests ===== | + | <doodle title=" |
- | TBD | + | * Yes |
+ | * No | ||
+ | </ | ||
- | ===== Implementation | + | Voting started on 2015-03-15 and ends on 2015-03-29. |
- | TBD | + | |
+ | ===== Patches and Tests ===== | ||
+ | * https:// | ||
===== 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.5: Removed integer support, so the strictness is consistent. | ||
+ | * v0.4: Removed possibility to check multiple values using an array. |
rfc/in_operator.1424436632.txt.gz · Last modified: 2017/09/22 13:28 (external edit)