1--TEST-- 2Test << operator : various numbers as strings 3--SKIPIF-- 4<?php 5if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); 6?> 7--FILE-- 8<?php 9 10$strVals = array( 11 "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a", 12 "a5.9" 13); 14 15error_reporting(E_ERROR); 16 17foreach ($strVals as $strVal) { 18 foreach($strVals as $otherVal) { 19 echo "--- testing: '$strVal' << '$otherVal' ---\n"; 20 var_dump(bin2hex($strVal<<$otherVal)); 21 } 22} 23 24 25?> 26===DONE=== 27--EXPECT-- 28--- testing: '0' << '0' --- 29string(2) "30" 30--- testing: '0' << '65' --- 31string(2) "30" 32--- testing: '0' << '-44' --- 33string(2) "30" 34--- testing: '0' << '1.2' --- 35string(2) "30" 36--- testing: '0' << '-7.7' --- 37string(2) "30" 38--- testing: '0' << 'abc' --- 39string(2) "30" 40--- testing: '0' << '123abc' --- 41string(2) "30" 42--- testing: '0' << '123e5' --- 43string(2) "30" 44--- testing: '0' << '123e5xyz' --- 45string(2) "30" 46--- testing: '0' << ' 123abc' --- 47string(2) "30" 48--- testing: '0' << '123 abc' --- 49string(2) "30" 50--- testing: '0' << '123abc ' --- 51string(2) "30" 52--- testing: '0' << '3.4a' --- 53string(2) "30" 54--- testing: '0' << 'a5.9' --- 55string(2) "30" 56--- testing: '65' << '0' --- 57string(4) "3635" 58--- testing: '65' << '65' --- 59string(6) "313330" 60--- testing: '65' << '-44' --- 61string(16) "3638313537343430" 62--- testing: '65' << '1.2' --- 63string(6) "313330" 64--- testing: '65' << '-7.7' --- 65string(40) "2d39303739323536383438373738393139393336" 66--- testing: '65' << 'abc' --- 67string(4) "3635" 68--- testing: '65' << '123abc' --- 69string(36) "353736343630373532333033343233343838" 70--- testing: '65' << '123e5' --- 71string(36) "353736343630373532333033343233343838" 72--- testing: '65' << '123e5xyz' --- 73string(36) "353736343630373532333033343233343838" 74--- testing: '65' << ' 123abc' --- 75string(36) "353736343630373532333033343233343838" 76--- testing: '65' << '123 abc' --- 77string(36) "353736343630373532333033343233343838" 78--- testing: '65' << '123abc ' --- 79string(36) "353736343630373532333033343233343838" 80--- testing: '65' << '3.4a' --- 81string(6) "353230" 82--- testing: '65' << 'a5.9' --- 83string(4) "3635" 84--- testing: '-44' << '0' --- 85string(6) "2d3434" 86--- testing: '-44' << '65' --- 87string(6) "2d3838" 88--- testing: '-44' << '-44' --- 89string(18) "2d3436313337333434" 90--- testing: '-44' << '1.2' --- 91string(6) "2d3838" 92--- testing: '-44' << '-7.7' --- 93string(40) "2d36333431303638323735333337363538333638" 94--- testing: '-44' << 'abc' --- 95string(6) "2d3434" 96--- testing: '-44' << '123abc' --- 97string(40) "2d36393137353239303237363431303831383536" 98--- testing: '-44' << '123e5' --- 99string(40) "2d36393137353239303237363431303831383536" 100--- testing: '-44' << '123e5xyz' --- 101string(40) "2d36393137353239303237363431303831383536" 102--- testing: '-44' << ' 123abc' --- 103string(40) "2d36393137353239303237363431303831383536" 104--- testing: '-44' << '123 abc' --- 105string(40) "2d36393137353239303237363431303831383536" 106--- testing: '-44' << '123abc ' --- 107string(40) "2d36393137353239303237363431303831383536" 108--- testing: '-44' << '3.4a' --- 109string(8) "2d333532" 110--- testing: '-44' << 'a5.9' --- 111string(6) "2d3434" 112--- testing: '1.2' << '0' --- 113string(2) "31" 114--- testing: '1.2' << '65' --- 115string(2) "32" 116--- testing: '1.2' << '-44' --- 117string(14) "31303438353736" 118--- testing: '1.2' << '1.2' --- 119string(2) "32" 120--- testing: '1.2' << '-7.7' --- 121string(36) "313434313135313838303735383535383732" 122--- testing: '1.2' << 'abc' --- 123string(2) "31" 124--- testing: '1.2' << '123abc' --- 125string(36) "353736343630373532333033343233343838" 126--- testing: '1.2' << '123e5' --- 127string(36) "353736343630373532333033343233343838" 128--- testing: '1.2' << '123e5xyz' --- 129string(36) "353736343630373532333033343233343838" 130--- testing: '1.2' << ' 123abc' --- 131string(36) "353736343630373532333033343233343838" 132--- testing: '1.2' << '123 abc' --- 133string(36) "353736343630373532333033343233343838" 134--- testing: '1.2' << '123abc ' --- 135string(36) "353736343630373532333033343233343838" 136--- testing: '1.2' << '3.4a' --- 137string(2) "38" 138--- testing: '1.2' << 'a5.9' --- 139string(2) "31" 140--- testing: '-7.7' << '0' --- 141string(4) "2d37" 142--- testing: '-7.7' << '65' --- 143string(6) "2d3134" 144--- testing: '-7.7' << '-44' --- 145string(16) "2d37333430303332" 146--- testing: '-7.7' << '1.2' --- 147string(6) "2d3134" 148--- testing: '-7.7' << '-7.7' --- 149string(40) "2d31303038383036333136353330393931313034" 150--- testing: '-7.7' << 'abc' --- 151string(4) "2d37" 152--- testing: '-7.7' << '123abc' --- 153string(40) "2d34303335323235323636313233393634343136" 154--- testing: '-7.7' << '123e5' --- 155string(40) "2d34303335323235323636313233393634343136" 156--- testing: '-7.7' << '123e5xyz' --- 157string(40) "2d34303335323235323636313233393634343136" 158--- testing: '-7.7' << ' 123abc' --- 159string(40) "2d34303335323235323636313233393634343136" 160--- testing: '-7.7' << '123 abc' --- 161string(40) "2d34303335323235323636313233393634343136" 162--- testing: '-7.7' << '123abc ' --- 163string(40) "2d34303335323235323636313233393634343136" 164--- testing: '-7.7' << '3.4a' --- 165string(6) "2d3536" 166--- testing: '-7.7' << 'a5.9' --- 167string(4) "2d37" 168--- testing: 'abc' << '0' --- 169string(2) "30" 170--- testing: 'abc' << '65' --- 171string(2) "30" 172--- testing: 'abc' << '-44' --- 173string(2) "30" 174--- testing: 'abc' << '1.2' --- 175string(2) "30" 176--- testing: 'abc' << '-7.7' --- 177string(2) "30" 178--- testing: 'abc' << 'abc' --- 179string(2) "30" 180--- testing: 'abc' << '123abc' --- 181string(2) "30" 182--- testing: 'abc' << '123e5' --- 183string(2) "30" 184--- testing: 'abc' << '123e5xyz' --- 185string(2) "30" 186--- testing: 'abc' << ' 123abc' --- 187string(2) "30" 188--- testing: 'abc' << '123 abc' --- 189string(2) "30" 190--- testing: 'abc' << '123abc ' --- 191string(2) "30" 192--- testing: 'abc' << '3.4a' --- 193string(2) "30" 194--- testing: 'abc' << 'a5.9' --- 195string(2) "30" 196--- testing: '123abc' << '0' --- 197string(6) "313233" 198--- testing: '123abc' << '65' --- 199string(6) "323436" 200--- testing: '123abc' << '-44' --- 201string(18) "313238393734383438" 202--- testing: '123abc' << '1.2' --- 203string(6) "323436" 204--- testing: '123abc' << '-7.7' --- 205string(38) "2d373230353735393430333739323739333630" 206--- testing: '123abc' << 'abc' --- 207string(6) "313233" 208--- testing: '123abc' << '123abc' --- 209string(40) "2d32383832333033373631353137313137343430" 210--- testing: '123abc' << '123e5' --- 211string(40) "2d32383832333033373631353137313137343430" 212--- testing: '123abc' << '123e5xyz' --- 213string(40) "2d32383832333033373631353137313137343430" 214--- testing: '123abc' << ' 123abc' --- 215string(40) "2d32383832333033373631353137313137343430" 216--- testing: '123abc' << '123 abc' --- 217string(40) "2d32383832333033373631353137313137343430" 218--- testing: '123abc' << '123abc ' --- 219string(40) "2d32383832333033373631353137313137343430" 220--- testing: '123abc' << '3.4a' --- 221string(6) "393834" 222--- testing: '123abc' << 'a5.9' --- 223string(6) "313233" 224--- testing: '123e5' << '0' --- 225string(6) "313233" 226--- testing: '123e5' << '65' --- 227string(6) "323436" 228--- testing: '123e5' << '-44' --- 229string(18) "313238393734383438" 230--- testing: '123e5' << '1.2' --- 231string(6) "323436" 232--- testing: '123e5' << '-7.7' --- 233string(38) "2d373230353735393430333739323739333630" 234--- testing: '123e5' << 'abc' --- 235string(6) "313233" 236--- testing: '123e5' << '123abc' --- 237string(40) "2d32383832333033373631353137313137343430" 238--- testing: '123e5' << '123e5' --- 239string(40) "2d32383832333033373631353137313137343430" 240--- testing: '123e5' << '123e5xyz' --- 241string(40) "2d32383832333033373631353137313137343430" 242--- testing: '123e5' << ' 123abc' --- 243string(40) "2d32383832333033373631353137313137343430" 244--- testing: '123e5' << '123 abc' --- 245string(40) "2d32383832333033373631353137313137343430" 246--- testing: '123e5' << '123abc ' --- 247string(40) "2d32383832333033373631353137313137343430" 248--- testing: '123e5' << '3.4a' --- 249string(6) "393834" 250--- testing: '123e5' << 'a5.9' --- 251string(6) "313233" 252--- testing: '123e5xyz' << '0' --- 253string(6) "313233" 254--- testing: '123e5xyz' << '65' --- 255string(6) "323436" 256--- testing: '123e5xyz' << '-44' --- 257string(18) "313238393734383438" 258--- testing: '123e5xyz' << '1.2' --- 259string(6) "323436" 260--- testing: '123e5xyz' << '-7.7' --- 261string(38) "2d373230353735393430333739323739333630" 262--- testing: '123e5xyz' << 'abc' --- 263string(6) "313233" 264--- testing: '123e5xyz' << '123abc' --- 265string(40) "2d32383832333033373631353137313137343430" 266--- testing: '123e5xyz' << '123e5' --- 267string(40) "2d32383832333033373631353137313137343430" 268--- testing: '123e5xyz' << '123e5xyz' --- 269string(40) "2d32383832333033373631353137313137343430" 270--- testing: '123e5xyz' << ' 123abc' --- 271string(40) "2d32383832333033373631353137313137343430" 272--- testing: '123e5xyz' << '123 abc' --- 273string(40) "2d32383832333033373631353137313137343430" 274--- testing: '123e5xyz' << '123abc ' --- 275string(40) "2d32383832333033373631353137313137343430" 276--- testing: '123e5xyz' << '3.4a' --- 277string(6) "393834" 278--- testing: '123e5xyz' << 'a5.9' --- 279string(6) "313233" 280--- testing: ' 123abc' << '0' --- 281string(6) "313233" 282--- testing: ' 123abc' << '65' --- 283string(6) "323436" 284--- testing: ' 123abc' << '-44' --- 285string(18) "313238393734383438" 286--- testing: ' 123abc' << '1.2' --- 287string(6) "323436" 288--- testing: ' 123abc' << '-7.7' --- 289string(38) "2d373230353735393430333739323739333630" 290--- testing: ' 123abc' << 'abc' --- 291string(6) "313233" 292--- testing: ' 123abc' << '123abc' --- 293string(40) "2d32383832333033373631353137313137343430" 294--- testing: ' 123abc' << '123e5' --- 295string(40) "2d32383832333033373631353137313137343430" 296--- testing: ' 123abc' << '123e5xyz' --- 297string(40) "2d32383832333033373631353137313137343430" 298--- testing: ' 123abc' << ' 123abc' --- 299string(40) "2d32383832333033373631353137313137343430" 300--- testing: ' 123abc' << '123 abc' --- 301string(40) "2d32383832333033373631353137313137343430" 302--- testing: ' 123abc' << '123abc ' --- 303string(40) "2d32383832333033373631353137313137343430" 304--- testing: ' 123abc' << '3.4a' --- 305string(6) "393834" 306--- testing: ' 123abc' << 'a5.9' --- 307string(6) "313233" 308--- testing: '123 abc' << '0' --- 309string(6) "313233" 310--- testing: '123 abc' << '65' --- 311string(6) "323436" 312--- testing: '123 abc' << '-44' --- 313string(18) "313238393734383438" 314--- testing: '123 abc' << '1.2' --- 315string(6) "323436" 316--- testing: '123 abc' << '-7.7' --- 317string(38) "2d373230353735393430333739323739333630" 318--- testing: '123 abc' << 'abc' --- 319string(6) "313233" 320--- testing: '123 abc' << '123abc' --- 321string(40) "2d32383832333033373631353137313137343430" 322--- testing: '123 abc' << '123e5' --- 323string(40) "2d32383832333033373631353137313137343430" 324--- testing: '123 abc' << '123e5xyz' --- 325string(40) "2d32383832333033373631353137313137343430" 326--- testing: '123 abc' << ' 123abc' --- 327string(40) "2d32383832333033373631353137313137343430" 328--- testing: '123 abc' << '123 abc' --- 329string(40) "2d32383832333033373631353137313137343430" 330--- testing: '123 abc' << '123abc ' --- 331string(40) "2d32383832333033373631353137313137343430" 332--- testing: '123 abc' << '3.4a' --- 333string(6) "393834" 334--- testing: '123 abc' << 'a5.9' --- 335string(6) "313233" 336--- testing: '123abc ' << '0' --- 337string(6) "313233" 338--- testing: '123abc ' << '65' --- 339string(6) "323436" 340--- testing: '123abc ' << '-44' --- 341string(18) "313238393734383438" 342--- testing: '123abc ' << '1.2' --- 343string(6) "323436" 344--- testing: '123abc ' << '-7.7' --- 345string(38) "2d373230353735393430333739323739333630" 346--- testing: '123abc ' << 'abc' --- 347string(6) "313233" 348--- testing: '123abc ' << '123abc' --- 349string(40) "2d32383832333033373631353137313137343430" 350--- testing: '123abc ' << '123e5' --- 351string(40) "2d32383832333033373631353137313137343430" 352--- testing: '123abc ' << '123e5xyz' --- 353string(40) "2d32383832333033373631353137313137343430" 354--- testing: '123abc ' << ' 123abc' --- 355string(40) "2d32383832333033373631353137313137343430" 356--- testing: '123abc ' << '123 abc' --- 357string(40) "2d32383832333033373631353137313137343430" 358--- testing: '123abc ' << '123abc ' --- 359string(40) "2d32383832333033373631353137313137343430" 360--- testing: '123abc ' << '3.4a' --- 361string(6) "393834" 362--- testing: '123abc ' << 'a5.9' --- 363string(6) "313233" 364--- testing: '3.4a' << '0' --- 365string(2) "33" 366--- testing: '3.4a' << '65' --- 367string(2) "36" 368--- testing: '3.4a' << '-44' --- 369string(14) "33313435373238" 370--- testing: '3.4a' << '1.2' --- 371string(2) "36" 372--- testing: '3.4a' << '-7.7' --- 373string(36) "343332333435353634323237353637363136" 374--- testing: '3.4a' << 'abc' --- 375string(2) "33" 376--- testing: '3.4a' << '123abc' --- 377string(38) "31373239333832323536393130323730343634" 378--- testing: '3.4a' << '123e5' --- 379string(38) "31373239333832323536393130323730343634" 380--- testing: '3.4a' << '123e5xyz' --- 381string(38) "31373239333832323536393130323730343634" 382--- testing: '3.4a' << ' 123abc' --- 383string(38) "31373239333832323536393130323730343634" 384--- testing: '3.4a' << '123 abc' --- 385string(38) "31373239333832323536393130323730343634" 386--- testing: '3.4a' << '123abc ' --- 387string(38) "31373239333832323536393130323730343634" 388--- testing: '3.4a' << '3.4a' --- 389string(4) "3234" 390--- testing: '3.4a' << 'a5.9' --- 391string(2) "33" 392--- testing: 'a5.9' << '0' --- 393string(2) "30" 394--- testing: 'a5.9' << '65' --- 395string(2) "30" 396--- testing: 'a5.9' << '-44' --- 397string(2) "30" 398--- testing: 'a5.9' << '1.2' --- 399string(2) "30" 400--- testing: 'a5.9' << '-7.7' --- 401string(2) "30" 402--- testing: 'a5.9' << 'abc' --- 403string(2) "30" 404--- testing: 'a5.9' << '123abc' --- 405string(2) "30" 406--- testing: 'a5.9' << '123e5' --- 407string(2) "30" 408--- testing: 'a5.9' << '123e5xyz' --- 409string(2) "30" 410--- testing: 'a5.9' << ' 123abc' --- 411string(2) "30" 412--- testing: 'a5.9' << '123 abc' --- 413string(2) "30" 414--- testing: 'a5.9' << '123abc ' --- 415string(2) "30" 416--- testing: 'a5.9' << '3.4a' --- 417string(2) "30" 418--- testing: 'a5.9' << 'a5.9' --- 419string(2) "30" 420===DONE=== 421