rfc:explicit_octal_notation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
rfc:explicit_octal_notation [2020/10/21 14:59] – Change status girgias | rfc:explicit_octal_notation [2020/11/25 12:21] – Close vote girgias | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2020-10-20 | * Date: 2020-10-20 | ||
* Author: George Peter Banyard, < | * Author: George Peter Banyard, < | ||
- | * Status: | + | * Status: |
* First Published at: https:// | * First Published at: https:// | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | PHP's literal octal notation can lead to some confusing results such as <php>" | + | PHP's literal octal notation can lead to some confusing results such as <php>16 === 016</ |
This convention for octal integers is well established and followed by many programming languages (Java, C, C#, Golang, Haskell, and more). However, Python, JavaScript, and Rust [[https:// | This convention for octal integers is well established and followed by many programming languages (Java, C, C#, Golang, Haskell, and more). However, Python, JavaScript, and Rust [[https:// | ||
- | Surprisingly PHP already has support for this notation | + | Surprisingly PHP already has support for this notation when using the < |
===== Proposal ===== | ===== Proposal ===== | ||
- | Add support for the explicit octal notation '' | + | Add support for the explicit octal notation '' |
<code php> | <code php> | ||
0o16 === 14; // true | 0o16 === 14; // true | ||
0o123 === 83; // true | 0o123 === 83; // true | ||
+ | |||
+ | 0O16 === 14; // true | ||
+ | 0O123 === 83; // true | ||
016 === 0o16; // true | 016 === 0o16; // true | ||
+ | 016 === 0O16; // true | ||
</ | </ | ||
Line 31: | Line 35: | ||
< | < | ||
- | Therefore, this RFC has no impact on numeric strings. | + | Numeric strings in PHP are //always// decimal. Analogous to the example from the introduction < |
+ | |||
+ | This RFC has no impact on the behaviour of numeric strings. | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 37: | Line 43: | ||
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
- | Next PHP 8.x. | + | PHP 8.1. |
===== RFC Impact ===== | ===== RFC Impact ===== | ||
Line 56: | Line 62: | ||
* Deprecate the implicit octal notation. | * Deprecate the implicit octal notation. | ||
* Support hexadecimal, | * Support hexadecimal, | ||
+ | * Add a flag for the < | ||
- | ===== Proposed | + | ===== Voting Choices ===== |
Per the Voting RFC, there is a single Yes/No vote requiring a 2/3 majority for this proposal to be accepted. | Per the Voting RFC, there is a single Yes/No vote requiring a 2/3 majority for this proposal to be accepted. |
rfc/explicit_octal_notation.txt · Last modified: 2021/01/04 20:12 by girgias