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/20 12:50] – Under Discussion kelunik | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== PHP RFC: Your Title Here ====== | + | ====== PHP RFC: In Operator |
- | * Version: 0.1 | + | * Version: 0.3 |
- | * Date: 2015-02-02 | + | * Date: 2015-02-20 |
- | * 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 [" | ||
+ | </ | ||
- | | + | <code php> |
- | $stdClass->foo = " | + | function gen () { |
- | $contains = " | + | yield " |
- | $contains = " | + | yield " |
+ | } | ||
+ | |||
+ | $contains | ||
+ | </ | ||
+ | |||
+ | If the first parameter is an array , it checks for every element whether it's contained in the '' | ||
+ | |||
+ | <code php> | ||
+ | $contains | ||
+ | $contains = [" | ||
+ | $contains = [[" | ||
+ | $contains = [[" | ||
+ | </ | ||
+ | |||
+ | For strings, it behaves exactly like '' | ||
+ | <code php> | ||
+ | $contains = " | ||
+ | $contains = " | ||
+ | </ | ||
+ | |||
+ | 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) ===== | ||
Line 31: | Line 67: | ||
===== RFC Impact ===== | ===== RFC Impact ===== | ||
- | ==== To SAPIs ==== | ||
- | Describe the impact to CLI, Development web server, embedded PHP etc. | ||
- | |||
- | ==== To Existing Extensions ==== | ||
- | Will existing extensions be affected? | ||
- | |||
- | ==== To Opcache ==== | ||
- | It is necessary to develop RFC's with opcache in mind, since opcache is a core extension distributed with PHP. | ||
- | |||
- | Please explain how you have verified your RFC's compatibility with opcache. | ||
- | |||
==== New Constants ==== | ==== New Constants ==== | ||
A '' | A '' | ||
Line 47: | Line 72: | ||
===== Open Issues ===== | ===== Open Issues ===== | ||
Make sure there are no open issues when the vote starts! | Make sure there are no open issues when the vote starts! | ||
- | |||
- | ===== 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 ===== | ||
Line 57: | Line 77: | ||
===== 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. | + | TBD |
- | + | ||
- | 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 ===== | ===== Implementation ===== | ||
- | After the project is implemented, | + | TBD |
- | - the version(s) it was merged to | + | |
- | - a link to the git commit(s) | + | |
- | - a link to the PHP manual entry for the feature | + | |
- | + | ||
- | ===== 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. |
rfc/in_operator.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1