# [RFC] Add support for explicit octal notation for integer literals

- Thread: https://externals.io/message/112090
- Original archive: https://news-web.php.net/php.internals/112090
- Started by G. P. B. on 2020-10-21T14:59:09+00:00
- Messages: 5
- RFC: Explicit octal integer literal notation (Implemented (PHP 8.1)) — https://externals.io/rfc/explicit_octal_notation.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #112090 — G. P. B. — 2020-10-21T14:59:09+00:00

URL: https://externals.io/message/112090#112090

Hello internals,

A rather short RFC about adding support for the "0o" prefix for octal
integers.
https://wiki.php.net/rfc/explicit_octal_notation

Surprisingly PHP already accepts the prefix within `octdec()` and
 `base_convert()`.

I have hopefully covered all the cases where this may apply but if you find
another one please let me know.

Best regards

George P. Banyard

---

## #112094 — Sara Golemon — 2020-10-21T19:47:42+00:00

URL: https://externals.io/message/112090#112094 · In reply to: #112090

> A rather short RFC about adding support for the "0o" prefix for octal
> integers.
> https://wiki.php.net/rfc/explicit_octal_notation
>
> Surprisingly PHP already accepts the prefix within `octdec()` and
> `base_convert()`.
>
> I have hopefully covered all the cases where this may apply but if you find
> another one please let me know.
>
>
+1

As for deprecating the old syntax in the future, I'd be in favor of that.
I've been bit by this subtle number format a couple of times and writing a
tool to auto-convert to the new format is trivial.  Here's about 3 minutes
worth of effort, for example:
https://gist.github.com/sgolemon/6f9fbb3a95352cbab9297319022d19a5

-Sara

---

## #112115 — Nikita Popov — 2020-10-26T08:39:17+00:00

URL: https://externals.io/message/112090#112115 · In reply to: #112090

> Hello internals,
>
> A rather short RFC about adding support for the "0o" prefix for octal
> integers.
> https://wiki.php.net/rfc/explicit_octal_notation
>
> Surprisingly PHP already accepts the prefix within `octdec()` and
> `base_convert()`.
>
> I have hopefully covered all the cases where this may apply but if you find
> another one please let me know.
>
> Best regards
>
> George P. Banyard
>

Fully support this proposal.

Nikita

---

## #112164 — G. P. B. — 2020-11-03T19:18:32+00:00

URL: https://externals.io/message/112090#112164

> What is the practical use case for this. I think it will make code a bit
> more confusing
>
> 
>
> > […]
>
Please send all replies to the list as no one else can see them.
(And please don't top post).

I don't understand how this can be *more* confusing than:
014 evaluating to 12 because it's interpreted as an octal.
The point is to make it explicit that it's an octal number in the same way
we have
0x1A = 26 for hexadecimal numbers, and similarly 0b prefix for binary
integer literals.

Regards,

George P. Banyard

---

## #112188 — G. P. B. — 2020-11-07T09:00:06+00:00

URL: https://externals.io/message/112090#112188 · In reply to: #112090

Hello internals,

As the 2 week discussion period has passed I intend to open voting on
Tuesday the 10th of November.

I did a bit of rewording on the RFC but it is fundamentally identical:
https://wiki.php.net/rfc/explicit_octal_notation

Any remaining concerns, clarifications and/or questions should preferably
be asked before Tuesday.

Best regards,

George P. Banyard
