rfc:explicit_octal_notation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:explicit_octal_notation [2020/10/20 23:46] crellrfc:explicit_octal_notation [2020/10/21 14:59] – Change status girgias
Line 3: Line 3:
   * Date: 2020-10-20   * Date: 2020-10-20
   * Author: George Peter Banyard, <girgias@php.net>   * Author: George Peter Banyard, <girgias@php.net>
-  * Status: Draft+  * Status: Under Discussion
   * First Published at: https://wiki.php.net/rfc/explicit_octal_notation   * First Published at: https://wiki.php.net/rfc/explicit_octal_notation
  
Line 11: Line 11:
  
 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://docs.python.org/3/reference/lexical_analysis.html#integer-literals|[1]]][[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Numbers_and_dates|[2]]][[https://doc.rust-lang.org/rust-by-example/primitives/literals.html|[3]]] only accept or support an explicit octal notation ''0o''. 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://docs.python.org/3/reference/lexical_analysis.html#integer-literals|[1]]][[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Numbers_and_dates|[2]]][[https://doc.rust-lang.org/rust-by-example/primitives/literals.html|[3]]] only accept or support an explicit octal notation ''0o''.
 +
 +Surprisingly PHP already has support for this notation and ''0O'' when using the <php>octdec()</php> and <php>base_convert()</php> functions.
  
 ===== Proposal ===== ===== Proposal =====
Line 40: Line 42:
 ==== To Existing Extensions ==== ==== To Existing Extensions ====
 Added support to the GMP extension. Added support to the GMP extension.
 +
 +Added support to the <php>FILTER_VALIDATE_INT</php> filter when using the <php>FILTER_FLAG_ALLOW_OCTAL</php> flag
  
 ==== To Opcache ==== ==== To Opcache ====
Line 81: Line 85:
 [[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Numbers_and_dates|[2]]] JavaScript language references about numbers \\ [[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Numbers_and_dates|[2]]] JavaScript language references about numbers \\
 [[https://doc.rust-lang.org/rust-by-example/primitives/literals.html|[3]]] Rust language reference about literals \\ [[https://doc.rust-lang.org/rust-by-example/primitives/literals.html|[3]]] Rust language reference about literals \\
-[[rfc:remove_hex_support_in_numeric_strings|4]] PHP RFC: Remove hex support in numeric strings+[[rfc:remove_hex_support_in_numeric_strings|[4]]] PHP RFC: Remove hex support in numeric strings
  
  
rfc/explicit_octal_notation.txt · Last modified: 2021/01/04 20:12 by girgias