1--TEST-- 2Test | operator : 64bit long tests 3--SKIPIF-- 4<?php 5if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); 6?> 7--FILE-- 8<?php 9 10define("MAX_64Bit", 9223372036854775807); 11define("MAX_32Bit", 2147483647); 12define("MIN_64Bit", -9223372036854775807 - 1); 13define("MIN_32Bit", -2147483647 - 1); 14 15$longVals = array( 16 MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit, 17 MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, 18 MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1 19); 20 21$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit); 22 23error_reporting(E_ERROR); 24 25foreach ($longVals as $longVal) { 26 foreach($otherVals as $otherVal) { 27 echo "--- testing: $longVal | $otherVal ---\n"; 28 var_dump($longVal|$otherVal); 29 } 30} 31 32foreach ($otherVals as $otherVal) { 33 foreach($longVals as $longVal) { 34 echo "--- testing: $otherVal | $longVal ---\n"; 35 var_dump($otherVal|$longVal); 36 } 37} 38 39?> 40--EXPECT-- 41--- testing: 9223372036854775807 | 0 --- 42int(9223372036854775807) 43--- testing: 9223372036854775807 | 1 --- 44int(9223372036854775807) 45--- testing: 9223372036854775807 | -1 --- 46int(-1) 47--- testing: 9223372036854775807 | 7 --- 48int(9223372036854775807) 49--- testing: 9223372036854775807 | 9 --- 50int(9223372036854775807) 51--- testing: 9223372036854775807 | 65 --- 52int(9223372036854775807) 53--- testing: 9223372036854775807 | -44 --- 54int(-1) 55--- testing: 9223372036854775807 | 2147483647 --- 56int(9223372036854775807) 57--- testing: 9223372036854775807 | 9223372036854775807 --- 58int(9223372036854775807) 59--- testing: -9223372036854775808 | 0 --- 60int(-9223372036854775808) 61--- testing: -9223372036854775808 | 1 --- 62int(-9223372036854775807) 63--- testing: -9223372036854775808 | -1 --- 64int(-1) 65--- testing: -9223372036854775808 | 7 --- 66int(-9223372036854775801) 67--- testing: -9223372036854775808 | 9 --- 68int(-9223372036854775799) 69--- testing: -9223372036854775808 | 65 --- 70int(-9223372036854775743) 71--- testing: -9223372036854775808 | -44 --- 72int(-44) 73--- testing: -9223372036854775808 | 2147483647 --- 74int(-9223372034707292161) 75--- testing: -9223372036854775808 | 9223372036854775807 --- 76int(-1) 77--- testing: 2147483647 | 0 --- 78int(2147483647) 79--- testing: 2147483647 | 1 --- 80int(2147483647) 81--- testing: 2147483647 | -1 --- 82int(-1) 83--- testing: 2147483647 | 7 --- 84int(2147483647) 85--- testing: 2147483647 | 9 --- 86int(2147483647) 87--- testing: 2147483647 | 65 --- 88int(2147483647) 89--- testing: 2147483647 | -44 --- 90int(-1) 91--- testing: 2147483647 | 2147483647 --- 92int(2147483647) 93--- testing: 2147483647 | 9223372036854775807 --- 94int(9223372036854775807) 95--- testing: -2147483648 | 0 --- 96int(-2147483648) 97--- testing: -2147483648 | 1 --- 98int(-2147483647) 99--- testing: -2147483648 | -1 --- 100int(-1) 101--- testing: -2147483648 | 7 --- 102int(-2147483641) 103--- testing: -2147483648 | 9 --- 104int(-2147483639) 105--- testing: -2147483648 | 65 --- 106int(-2147483583) 107--- testing: -2147483648 | -44 --- 108int(-44) 109--- testing: -2147483648 | 2147483647 --- 110int(-1) 111--- testing: -2147483648 | 9223372036854775807 --- 112int(-1) 113--- testing: 9223372034707292160 | 0 --- 114int(9223372034707292160) 115--- testing: 9223372034707292160 | 1 --- 116int(9223372034707292161) 117--- testing: 9223372034707292160 | -1 --- 118int(-1) 119--- testing: 9223372034707292160 | 7 --- 120int(9223372034707292167) 121--- testing: 9223372034707292160 | 9 --- 122int(9223372034707292169) 123--- testing: 9223372034707292160 | 65 --- 124int(9223372034707292225) 125--- testing: 9223372034707292160 | -44 --- 126int(-44) 127--- testing: 9223372034707292160 | 2147483647 --- 128int(9223372036854775807) 129--- testing: 9223372034707292160 | 9223372036854775807 --- 130int(9223372036854775807) 131--- testing: -9223372034707292160 | 0 --- 132int(-9223372034707292160) 133--- testing: -9223372034707292160 | 1 --- 134int(-9223372034707292159) 135--- testing: -9223372034707292160 | -1 --- 136int(-1) 137--- testing: -9223372034707292160 | 7 --- 138int(-9223372034707292153) 139--- testing: -9223372034707292160 | 9 --- 140int(-9223372034707292151) 141--- testing: -9223372034707292160 | 65 --- 142int(-9223372034707292095) 143--- testing: -9223372034707292160 | -44 --- 144int(-44) 145--- testing: -9223372034707292160 | 2147483647 --- 146int(-9223372032559808513) 147--- testing: -9223372034707292160 | 9223372036854775807 --- 148int(-1) 149--- testing: 2147483648 | 0 --- 150int(2147483648) 151--- testing: 2147483648 | 1 --- 152int(2147483649) 153--- testing: 2147483648 | -1 --- 154int(-1) 155--- testing: 2147483648 | 7 --- 156int(2147483655) 157--- testing: 2147483648 | 9 --- 158int(2147483657) 159--- testing: 2147483648 | 65 --- 160int(2147483713) 161--- testing: 2147483648 | -44 --- 162int(-44) 163--- testing: 2147483648 | 2147483647 --- 164int(4294967295) 165--- testing: 2147483648 | 9223372036854775807 --- 166int(9223372036854775807) 167--- testing: -2147483649 | 0 --- 168int(-2147483649) 169--- testing: -2147483649 | 1 --- 170int(-2147483649) 171--- testing: -2147483649 | -1 --- 172int(-1) 173--- testing: -2147483649 | 7 --- 174int(-2147483649) 175--- testing: -2147483649 | 9 --- 176int(-2147483649) 177--- testing: -2147483649 | 65 --- 178int(-2147483649) 179--- testing: -2147483649 | -44 --- 180int(-1) 181--- testing: -2147483649 | 2147483647 --- 182int(-2147483649) 183--- testing: -2147483649 | 9223372036854775807 --- 184int(-1) 185--- testing: 4294967294 | 0 --- 186int(4294967294) 187--- testing: 4294967294 | 1 --- 188int(4294967295) 189--- testing: 4294967294 | -1 --- 190int(-1) 191--- testing: 4294967294 | 7 --- 192int(4294967295) 193--- testing: 4294967294 | 9 --- 194int(4294967295) 195--- testing: 4294967294 | 65 --- 196int(4294967295) 197--- testing: 4294967294 | -44 --- 198int(-2) 199--- testing: 4294967294 | 2147483647 --- 200int(4294967295) 201--- testing: 4294967294 | 9223372036854775807 --- 202int(9223372036854775807) 203--- testing: 4294967295 | 0 --- 204int(4294967295) 205--- testing: 4294967295 | 1 --- 206int(4294967295) 207--- testing: 4294967295 | -1 --- 208int(-1) 209--- testing: 4294967295 | 7 --- 210int(4294967295) 211--- testing: 4294967295 | 9 --- 212int(4294967295) 213--- testing: 4294967295 | 65 --- 214int(4294967295) 215--- testing: 4294967295 | -44 --- 216int(-1) 217--- testing: 4294967295 | 2147483647 --- 218int(4294967295) 219--- testing: 4294967295 | 9223372036854775807 --- 220int(9223372036854775807) 221--- testing: 4294967293 | 0 --- 222int(4294967293) 223--- testing: 4294967293 | 1 --- 224int(4294967293) 225--- testing: 4294967293 | -1 --- 226int(-1) 227--- testing: 4294967293 | 7 --- 228int(4294967295) 229--- testing: 4294967293 | 9 --- 230int(4294967293) 231--- testing: 4294967293 | 65 --- 232int(4294967293) 233--- testing: 4294967293 | -44 --- 234int(-3) 235--- testing: 4294967293 | 2147483647 --- 236int(4294967295) 237--- testing: 4294967293 | 9223372036854775807 --- 238int(9223372036854775807) 239--- testing: 9223372036854775806 | 0 --- 240int(9223372036854775806) 241--- testing: 9223372036854775806 | 1 --- 242int(9223372036854775807) 243--- testing: 9223372036854775806 | -1 --- 244int(-1) 245--- testing: 9223372036854775806 | 7 --- 246int(9223372036854775807) 247--- testing: 9223372036854775806 | 9 --- 248int(9223372036854775807) 249--- testing: 9223372036854775806 | 65 --- 250int(9223372036854775807) 251--- testing: 9223372036854775806 | -44 --- 252int(-2) 253--- testing: 9223372036854775806 | 2147483647 --- 254int(9223372036854775807) 255--- testing: 9223372036854775806 | 9223372036854775807 --- 256int(9223372036854775807) 257--- testing: 9.2233720368548E+18 | 0 --- 258int(-9223372036854775808) 259--- testing: 9.2233720368548E+18 | 1 --- 260int(-9223372036854775807) 261--- testing: 9.2233720368548E+18 | -1 --- 262int(-1) 263--- testing: 9.2233720368548E+18 | 7 --- 264int(-9223372036854775801) 265--- testing: 9.2233720368548E+18 | 9 --- 266int(-9223372036854775799) 267--- testing: 9.2233720368548E+18 | 65 --- 268int(-9223372036854775743) 269--- testing: 9.2233720368548E+18 | -44 --- 270int(-44) 271--- testing: 9.2233720368548E+18 | 2147483647 --- 272int(-9223372034707292161) 273--- testing: 9.2233720368548E+18 | 9223372036854775807 --- 274int(-1) 275--- testing: -9223372036854775807 | 0 --- 276int(-9223372036854775807) 277--- testing: -9223372036854775807 | 1 --- 278int(-9223372036854775807) 279--- testing: -9223372036854775807 | -1 --- 280int(-1) 281--- testing: -9223372036854775807 | 7 --- 282int(-9223372036854775801) 283--- testing: -9223372036854775807 | 9 --- 284int(-9223372036854775799) 285--- testing: -9223372036854775807 | 65 --- 286int(-9223372036854775743) 287--- testing: -9223372036854775807 | -44 --- 288int(-43) 289--- testing: -9223372036854775807 | 2147483647 --- 290int(-9223372034707292161) 291--- testing: -9223372036854775807 | 9223372036854775807 --- 292int(-1) 293--- testing: -9.2233720368548E+18 | 0 --- 294int(-9223372036854775808) 295--- testing: -9.2233720368548E+18 | 1 --- 296int(-9223372036854775807) 297--- testing: -9.2233720368548E+18 | -1 --- 298int(-1) 299--- testing: -9.2233720368548E+18 | 7 --- 300int(-9223372036854775801) 301--- testing: -9.2233720368548E+18 | 9 --- 302int(-9223372036854775799) 303--- testing: -9.2233720368548E+18 | 65 --- 304int(-9223372036854775743) 305--- testing: -9.2233720368548E+18 | -44 --- 306int(-44) 307--- testing: -9.2233720368548E+18 | 2147483647 --- 308int(-9223372034707292161) 309--- testing: -9.2233720368548E+18 | 9223372036854775807 --- 310int(-1) 311--- testing: 0 | 9223372036854775807 --- 312int(9223372036854775807) 313--- testing: 0 | -9223372036854775808 --- 314int(-9223372036854775808) 315--- testing: 0 | 2147483647 --- 316int(2147483647) 317--- testing: 0 | -2147483648 --- 318int(-2147483648) 319--- testing: 0 | 9223372034707292160 --- 320int(9223372034707292160) 321--- testing: 0 | -9223372034707292160 --- 322int(-9223372034707292160) 323--- testing: 0 | 2147483648 --- 324int(2147483648) 325--- testing: 0 | -2147483649 --- 326int(-2147483649) 327--- testing: 0 | 4294967294 --- 328int(4294967294) 329--- testing: 0 | 4294967295 --- 330int(4294967295) 331--- testing: 0 | 4294967293 --- 332int(4294967293) 333--- testing: 0 | 9223372036854775806 --- 334int(9223372036854775806) 335--- testing: 0 | 9.2233720368548E+18 --- 336int(-9223372036854775808) 337--- testing: 0 | -9223372036854775807 --- 338int(-9223372036854775807) 339--- testing: 0 | -9.2233720368548E+18 --- 340int(-9223372036854775808) 341--- testing: 1 | 9223372036854775807 --- 342int(9223372036854775807) 343--- testing: 1 | -9223372036854775808 --- 344int(-9223372036854775807) 345--- testing: 1 | 2147483647 --- 346int(2147483647) 347--- testing: 1 | -2147483648 --- 348int(-2147483647) 349--- testing: 1 | 9223372034707292160 --- 350int(9223372034707292161) 351--- testing: 1 | -9223372034707292160 --- 352int(-9223372034707292159) 353--- testing: 1 | 2147483648 --- 354int(2147483649) 355--- testing: 1 | -2147483649 --- 356int(-2147483649) 357--- testing: 1 | 4294967294 --- 358int(4294967295) 359--- testing: 1 | 4294967295 --- 360int(4294967295) 361--- testing: 1 | 4294967293 --- 362int(4294967293) 363--- testing: 1 | 9223372036854775806 --- 364int(9223372036854775807) 365--- testing: 1 | 9.2233720368548E+18 --- 366int(-9223372036854775807) 367--- testing: 1 | -9223372036854775807 --- 368int(-9223372036854775807) 369--- testing: 1 | -9.2233720368548E+18 --- 370int(-9223372036854775807) 371--- testing: -1 | 9223372036854775807 --- 372int(-1) 373--- testing: -1 | -9223372036854775808 --- 374int(-1) 375--- testing: -1 | 2147483647 --- 376int(-1) 377--- testing: -1 | -2147483648 --- 378int(-1) 379--- testing: -1 | 9223372034707292160 --- 380int(-1) 381--- testing: -1 | -9223372034707292160 --- 382int(-1) 383--- testing: -1 | 2147483648 --- 384int(-1) 385--- testing: -1 | -2147483649 --- 386int(-1) 387--- testing: -1 | 4294967294 --- 388int(-1) 389--- testing: -1 | 4294967295 --- 390int(-1) 391--- testing: -1 | 4294967293 --- 392int(-1) 393--- testing: -1 | 9223372036854775806 --- 394int(-1) 395--- testing: -1 | 9.2233720368548E+18 --- 396int(-1) 397--- testing: -1 | -9223372036854775807 --- 398int(-1) 399--- testing: -1 | -9.2233720368548E+18 --- 400int(-1) 401--- testing: 7 | 9223372036854775807 --- 402int(9223372036854775807) 403--- testing: 7 | -9223372036854775808 --- 404int(-9223372036854775801) 405--- testing: 7 | 2147483647 --- 406int(2147483647) 407--- testing: 7 | -2147483648 --- 408int(-2147483641) 409--- testing: 7 | 9223372034707292160 --- 410int(9223372034707292167) 411--- testing: 7 | -9223372034707292160 --- 412int(-9223372034707292153) 413--- testing: 7 | 2147483648 --- 414int(2147483655) 415--- testing: 7 | -2147483649 --- 416int(-2147483649) 417--- testing: 7 | 4294967294 --- 418int(4294967295) 419--- testing: 7 | 4294967295 --- 420int(4294967295) 421--- testing: 7 | 4294967293 --- 422int(4294967295) 423--- testing: 7 | 9223372036854775806 --- 424int(9223372036854775807) 425--- testing: 7 | 9.2233720368548E+18 --- 426int(-9223372036854775801) 427--- testing: 7 | -9223372036854775807 --- 428int(-9223372036854775801) 429--- testing: 7 | -9.2233720368548E+18 --- 430int(-9223372036854775801) 431--- testing: 9 | 9223372036854775807 --- 432int(9223372036854775807) 433--- testing: 9 | -9223372036854775808 --- 434int(-9223372036854775799) 435--- testing: 9 | 2147483647 --- 436int(2147483647) 437--- testing: 9 | -2147483648 --- 438int(-2147483639) 439--- testing: 9 | 9223372034707292160 --- 440int(9223372034707292169) 441--- testing: 9 | -9223372034707292160 --- 442int(-9223372034707292151) 443--- testing: 9 | 2147483648 --- 444int(2147483657) 445--- testing: 9 | -2147483649 --- 446int(-2147483649) 447--- testing: 9 | 4294967294 --- 448int(4294967295) 449--- testing: 9 | 4294967295 --- 450int(4294967295) 451--- testing: 9 | 4294967293 --- 452int(4294967293) 453--- testing: 9 | 9223372036854775806 --- 454int(9223372036854775807) 455--- testing: 9 | 9.2233720368548E+18 --- 456int(-9223372036854775799) 457--- testing: 9 | -9223372036854775807 --- 458int(-9223372036854775799) 459--- testing: 9 | -9.2233720368548E+18 --- 460int(-9223372036854775799) 461--- testing: 65 | 9223372036854775807 --- 462int(9223372036854775807) 463--- testing: 65 | -9223372036854775808 --- 464int(-9223372036854775743) 465--- testing: 65 | 2147483647 --- 466int(2147483647) 467--- testing: 65 | -2147483648 --- 468int(-2147483583) 469--- testing: 65 | 9223372034707292160 --- 470int(9223372034707292225) 471--- testing: 65 | -9223372034707292160 --- 472int(-9223372034707292095) 473--- testing: 65 | 2147483648 --- 474int(2147483713) 475--- testing: 65 | -2147483649 --- 476int(-2147483649) 477--- testing: 65 | 4294967294 --- 478int(4294967295) 479--- testing: 65 | 4294967295 --- 480int(4294967295) 481--- testing: 65 | 4294967293 --- 482int(4294967293) 483--- testing: 65 | 9223372036854775806 --- 484int(9223372036854775807) 485--- testing: 65 | 9.2233720368548E+18 --- 486int(-9223372036854775743) 487--- testing: 65 | -9223372036854775807 --- 488int(-9223372036854775743) 489--- testing: 65 | -9.2233720368548E+18 --- 490int(-9223372036854775743) 491--- testing: -44 | 9223372036854775807 --- 492int(-1) 493--- testing: -44 | -9223372036854775808 --- 494int(-44) 495--- testing: -44 | 2147483647 --- 496int(-1) 497--- testing: -44 | -2147483648 --- 498int(-44) 499--- testing: -44 | 9223372034707292160 --- 500int(-44) 501--- testing: -44 | -9223372034707292160 --- 502int(-44) 503--- testing: -44 | 2147483648 --- 504int(-44) 505--- testing: -44 | -2147483649 --- 506int(-1) 507--- testing: -44 | 4294967294 --- 508int(-2) 509--- testing: -44 | 4294967295 --- 510int(-1) 511--- testing: -44 | 4294967293 --- 512int(-3) 513--- testing: -44 | 9223372036854775806 --- 514int(-2) 515--- testing: -44 | 9.2233720368548E+18 --- 516int(-44) 517--- testing: -44 | -9223372036854775807 --- 518int(-43) 519--- testing: -44 | -9.2233720368548E+18 --- 520int(-44) 521--- testing: 2147483647 | 9223372036854775807 --- 522int(9223372036854775807) 523--- testing: 2147483647 | -9223372036854775808 --- 524int(-9223372034707292161) 525--- testing: 2147483647 | 2147483647 --- 526int(2147483647) 527--- testing: 2147483647 | -2147483648 --- 528int(-1) 529--- testing: 2147483647 | 9223372034707292160 --- 530int(9223372036854775807) 531--- testing: 2147483647 | -9223372034707292160 --- 532int(-9223372032559808513) 533--- testing: 2147483647 | 2147483648 --- 534int(4294967295) 535--- testing: 2147483647 | -2147483649 --- 536int(-2147483649) 537--- testing: 2147483647 | 4294967294 --- 538int(4294967295) 539--- testing: 2147483647 | 4294967295 --- 540int(4294967295) 541--- testing: 2147483647 | 4294967293 --- 542int(4294967295) 543--- testing: 2147483647 | 9223372036854775806 --- 544int(9223372036854775807) 545--- testing: 2147483647 | 9.2233720368548E+18 --- 546int(-9223372034707292161) 547--- testing: 2147483647 | -9223372036854775807 --- 548int(-9223372034707292161) 549--- testing: 2147483647 | -9.2233720368548E+18 --- 550int(-9223372034707292161) 551--- testing: 9223372036854775807 | 9223372036854775807 --- 552int(9223372036854775807) 553--- testing: 9223372036854775807 | -9223372036854775808 --- 554int(-1) 555--- testing: 9223372036854775807 | 2147483647 --- 556int(9223372036854775807) 557--- testing: 9223372036854775807 | -2147483648 --- 558int(-1) 559--- testing: 9223372036854775807 | 9223372034707292160 --- 560int(9223372036854775807) 561--- testing: 9223372036854775807 | -9223372034707292160 --- 562int(-1) 563--- testing: 9223372036854775807 | 2147483648 --- 564int(9223372036854775807) 565--- testing: 9223372036854775807 | -2147483649 --- 566int(-1) 567--- testing: 9223372036854775807 | 4294967294 --- 568int(9223372036854775807) 569--- testing: 9223372036854775807 | 4294967295 --- 570int(9223372036854775807) 571--- testing: 9223372036854775807 | 4294967293 --- 572int(9223372036854775807) 573--- testing: 9223372036854775807 | 9223372036854775806 --- 574int(9223372036854775807) 575--- testing: 9223372036854775807 | 9.2233720368548E+18 --- 576int(-1) 577--- testing: 9223372036854775807 | -9223372036854775807 --- 578int(-1) 579--- testing: 9223372036854775807 | -9.2233720368548E+18 --- 580int(-1) 581