rfc:in_operator
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:in_operator [2015/02/02 13:10] – very basic draft kelunik | rfc:in_operator [2015/02/26 19:40] – kelunik | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== PHP RFC: Your Title Here ====== | + | ====== PHP RFC: In Operator |
- | * Version: 0.1 | + | * Version: 0.4 |
- | * Date: 2015-02-02 | + | * Date: 2015-02-26 |
- | * Author: Niklas Keller, me@kelunik.com | + | * 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 '' |
- | $contains | + | It uses strict comparison ('' |
- | $contains | + | |
- | $contains | + | |
- | $contains = " | + | |
- | For objects, it works a bit differently, it checks if '' | + | <code php> |
+ | $contains = " | ||
+ | $contains = " | ||
+ | $contains = " | ||
+ | $contains = " | ||
+ | $contains = 0 in [" | ||
- | | + | $contains |
- | $stdClass-> | + | $contains = ["foo"] in [" |
- | $contains = " | + | </ |
- | $contains = "bar" in $stdClass; // false | + | |
- | ===== Backward Incompatible Changes ===== | + | '' |
- | New reserved keyword | + | |
- | ===== Proposed PHP Version(s) ===== | + | <code php> |
- | Next major release, at the time of writing PHP 7. | + | function gen () { |
+ | yield " | ||
+ | yield " | ||
+ | // code below here wouldn' | ||
+ | // because it stops if there' | ||
+ | } | ||
- | ===== RFC Impact ===== | + | $contains |
- | ==== To SAPIs ==== | + | $contains |
- | Describe the impact to CLI, Development web server, embedded PHP etc. | + | </ |
- | ==== To Existing Extensions ==== | + | If '' |
- | Will existing extensions be affected? | + | <code php> |
+ | $contains | ||
+ | $contains | ||
+ | $contains | ||
+ | $contains | ||
+ | </ | ||
- | ==== To Opcache ==== | + | **Note**: This is a difference compared |
- | It is necessary | + | |
- | Please explain how you have verified your RFC's compatibility with opcache. | + | Other values than '' |
+ | If '' | ||
+ | |||
+ | ==== 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 ===== | ||
+ | New reserved keyword '' | ||
+ | |||
+ | ===== Proposed PHP Version(s) ===== | ||
+ | Next major release, at the time of writing PHP 7. | ||
+ | |||
+ | ===== RFC Impact ===== | ||
==== New Constants ==== | ==== New Constants ==== | ||
A '' | A '' | ||
===== Open Issues ===== | ===== Open Issues ===== | ||
- | Make sure there are no open issues when the vote starts! | + | None. |
- | + | ||
- | ===== Unaffected PHP Functionality ===== | + | |
- | List existing areas/ | + | |
- | + | ||
- | This helps avoid any ambiguity, shows that you have thought deeply about the RFC's impact, and helps reduces mail list noise. | + | |
===== 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 ===== | ||
- | Requires a 2/3 majority. | + | Requires a 2/3 majority, simple yes / no vote. |
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
- | Links to any external patches and tests go here. | + | * https:// |
- | + | ||
- | If there is no patch, make it clear who will create a patch, or whether a volunteer to help with implementation is needed. | + | |
- | + | ||
- | Make it clear if the patch is intended to be the final patch, or is just a prototype. | + | |
- | + | ||
- | ===== Implementation ===== | + | |
- | After the project is implemented, | + | |
- | - the version(s) it was merged to | + | |
- | - a link to the git commit(s) | + | |
- | | + | |
- | + | ||
- | ===== References ===== | + | |
- | Links to external references, discussions or RFCs | + | |
===== 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