PHP 8.1: Update integer docs for new octal notation

Closes GH-1091.
This commit is contained in:
cmp 2021-11-13 04:00:05 -06:00 committed by GitHub
parent 93ca935fa7
commit 085c38d45e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,6 +42,7 @@
<para>
To use octal notation, precede the number with a <literal>0</literal> (zero).
As of PHP 8.1.0, octal notation can also be preceded with <literal>0o</literal> or <literal>0O</literal>.
To use hexadecimal notation precede the number with <literal>0x</literal>.
To use binary notation precede the number with <literal>0b</literal>.
</para>
@ -58,6 +59,7 @@
<?php
$a = 1234; // decimal number
$a = 0123; // octal number (equivalent to 83 decimal)
$a = 0o123; // octal number (as of PHP 8.1.0)
$a = 0x1A; // hexadecimal number (equivalent to 26 decimal)
$a = 0b11111111; // binary number (equivalent to 255 decimal)
$a = 1_234_567; // decimal number (as of PHP 7.4.0)
@ -79,7 +81,7 @@ decimal : [1-9][0-9]*(_[0-9]+)*
hexadecimal : 0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*
octal : 0[0-7]+(_[0-7]+)*
octal : 0[oO]?[0-7]+(_[0-7]+)*
binary : 0[bB][01]+(_[01]+)*