rfc:alpanumeric_decrement
Differences
This shows you the differences between two versions of the page.
rfc:alpanumeric_decrement [2014/01/28 00:45] ajf Declined |
rfc:alpanumeric_decrement [2017/09/22 13:28] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== PHP RFC: Alphanumeric Decrement ====== | ||
- | * Version: 1.0 | ||
- | * Date: 2013-12-16 | ||
- | * Author: Andrea Faulds < | ||
- | * Status: Declined | ||
- | * First Published at: http:// | ||
- | |||
- | ===== Introduction ===== | ||
- | |||
- | This will add support for decrementing alphanumeric strings (" | ||
- | |||
- | ===== Proposal ===== | ||
- | |||
- | At present, incrementing alphanumeric strings is supported. For example: | ||
- | |||
- | $x = " | ||
- | $x++; | ||
- | // $x is now " | ||
- | |||
- | However, decrementing alphanumeric strings is not: | ||
- | |||
- | $x = " | ||
- | $x--; | ||
- | // $x is still " | ||
- | |||
- | Under this proposal, alphanumeric strings would be decrementable: | ||
- | |||
- | $x = " | ||
- | $x--; | ||
- | // $x is now " | ||
- | |||
- | It would also handle the edge case of decrementing from " | ||
- | |||
- | $x = " | ||
- | $x--; | ||
- | // $x is now 0 | ||
- | |||
- | The patch at present additionally changes how empty strings are incremented. At present, it works as follows: | ||
- | |||
- | $x = ""; | ||
- | $x++; | ||
- | // $x is now " | ||
- | $x = ""; | ||
- | $x--; | ||
- | // $x is now -1 (int) | ||
- | |||
- | With this patch, it is now consistent: | ||
- | |||
- | $x = ""; | ||
- | $x--; | ||
- | // $x is now " | ||
- | |||
- | ===== Backward Incompatible Changes ===== | ||
- | |||
- | This might arguably be a BC break, as now decrementing for these strings would work, while existing code might assume that doesn' | ||
- | |||
- | ===== Proposed PHP Version(s) ===== | ||
- | |||
- | Next PHP 5.x. Failing that, next PHP x. | ||
- | |||
- | ===== SAPIs Impacted ===== | ||
- | |||
- | None. | ||
- | |||
- | ===== Impact to Existing Extensions ===== | ||
- | |||
- | None. | ||
- | |||
- | ===== New Constants ===== | ||
- | |||
- | None. | ||
- | |||
- | ===== php.ini Defaults ===== | ||
- | |||
- | None. | ||
- | |||
- | ===== Open Issues ===== | ||
- | |||
- | How should decrementing " | ||
- | |||
- | ===== Unaffected PHP Functionality ===== | ||
- | |||
- | Does not affect $x += 1 and $x -= 1, nor $x = $x + 1 and $x = $x - 1, as both of these do not support alphanumeric increment at present. | ||
- | |||
- | ===== Future Scope ===== | ||
- | |||
- | In future, alphanumeric increment being supported $x += 1 and $x = $x + 1 might be desirable, but that is not within the scope of this RFC. | ||
- | |||
- | ===== Vote ===== | ||
- | |||
- | Merge into PHP 5.6? (Will assume this requires 2/3 majority, due to new language feature) | ||
- | |||
- | Voting started 2014-01-21 and ended 2014-01-28. | ||
- | |||
- | <doodle title=" | ||
- | * Yes | ||
- | * No | ||
- | </ | ||
- | |||
- | ===== Patches and Tests ===== | ||
- | |||
- | https:// | ||
- | |||
- | Considered final patch, unless bugs are found. | ||
- | |||
- | ===== Implementation ===== | ||
- | |||
- | Not merged in at present. | ||
- | |||
- | ===== References ===== | ||
- | |||
- | Mailing list discussion: http:// | ||
- | |||
- | ===== Rejected Features ===== | ||
- | |||
- | None as yet? |
rfc/alpanumeric_decrement.txt · Last modified: 2017/09/22 13:28 (external edit)