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