1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
--TEST--
Octal integer strings (64bit)
--SKIPIF--
<?php
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
?>
--FILE--
<?php
/* Using octal prefix notation lowercase */
/* Maximum value representable as integer */
$octal = 0o777777777777777777777;
var_dump($octal);
var_dump(PHP_INT_MAX);
/* *technically* this should work but treat this as a degenerate case */
$octal = 0o1000000000000000000000;
var_dump($octal);
/* Floating number */
$octal = 0o45734321536435450000000000;
var_dump($octal);
/* Integer */
$octal = 0o16;
var_dump($octal);
/* underscore separator */
$octal = 0o1_6;
var_dump($octal);
/* Ignore leading 0 and _ */
$octal = 0o0_016;
var_dump($octal);
$octal = 0o0_16;
var_dump($octal);
/* Overflow to infinity */
$octal = 0o77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777;
var_dump($octal);
/* Using octal prefix notation uppercase */
/* Maximum value representable as integer */
$octal = 0O777777777777777777777;
var_dump($octal);
var_dump(PHP_INT_MAX);
/* *technically* this should work but treat this as a degenerate case */
$octal = 0O1000000000000000000000;
var_dump($octal);
/* Floating number */
$octal = 0O45734321536435450000000000;
var_dump($octal);
/* Integer */
$octal = 0O16;
var_dump($octal);
/* underscore separator */
$octal = 0O1_6;
var_dump($octal);
/* Ignore leading 0 and _ */
$octal = 0O0_016;
var_dump($octal);
$octal = 0O0_16;
var_dump($octal);
/* Overflow to infinity */
$octal = 0O77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777;
var_dump($octal);
/* Using no dedicated prefix */
/* Maximum value representable as integer */
$octal = 0777777777777777777777;
var_dump($octal);
var_dump(PHP_INT_MAX);
/* *technically* this should work but treat this as a degenerate case */
$octal = 01000000000000000000000;
var_dump($octal);
/* Floating number */
$octal = 045734321536435450000000000;
var_dump($octal);
/* Integer */
$octal = 016;
var_dump($octal);
/* underscore separator */
$octal = 01_6;
var_dump($octal);
/* Ignore leading 0 and _ */
$octal = 00_016;
var_dump($octal);
$octal = 0_16;
var_dump($octal);
/* Overflow to infinity */
$octal = 077777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777;
var_dump($octal);
?>
--EXPECT--
int(9223372036854775807)
int(9223372036854775807)
float(9.223372036854776E+18)
float(1.7912166229916324E+23)
int(14)
int(14)
int(14)
int(14)
float(INF)
int(9223372036854775807)
int(9223372036854775807)
float(9.223372036854776E+18)
float(1.7912166229916324E+23)
int(14)
int(14)
int(14)
int(14)
float(INF)
int(9223372036854775807)
int(9223372036854775807)
float(9.223372036854776E+18)
float(1.7912166229916324E+23)
int(14)
int(14)
int(14)
int(14)
float(INF)
|