1--TEST-- 2Test token_get_all() function : usage variations - with assignment operators 3--EXTENSIONS-- 4tokenizer 5--FILE-- 6<?php 7/* 8 * Passing 'source' argument with different assignment operators to test them for tokens 9 * += - T_PLUS_EQUAL(277), -= - T_MINUS-EQUAL(276), 10 * *= - T_MUL_EQUAL(275), /= - T_DIVIDE_EQUAL(274), 11 * %= - T_MOD_EQUAL(272), &= - T_AND_EQUAL(271), 12 * |= - T_OR_EQUAL(271), ^= - T_EXOR_EQUAL(269), 13 * >>= - T_SR_EQUAL(267), <<= - T_SL_EQUAL(268), .= - T_CONCAT_EQUAL(273) 14*/ 15 16echo "*** Testing token_get_all() : 'source' string with different assignment operators ***\n"; 17 18// assignment operators : '+=', '-=', '*=', '/=', '%=', '&=', '|=', '^=', '>>=', '<<=', '.=' 19$source = '<?php 20$a = 1, $b = 2; 21$c += $b; 22$b -= $a; 23$a *= 2; 24$d /= 10.50; 25$a %= 10.50; 26$b &= $c; 27$c |= 1; 28$d ^= 5; 29$a >>= 1; 30$b <<= 2; 31$d .= "hello world"; 32?>'; 33var_dump( token_get_all($source)); 34 35echo "Done" 36?> 37--EXPECTF-- 38*** Testing token_get_all() : 'source' string with different assignment operators *** 39array(93) { 40 [0]=> 41 array(3) { 42 [0]=> 43 int(%d) 44 [1]=> 45 string(6) "<?php 46" 47 [2]=> 48 int(1) 49 } 50 [1]=> 51 array(3) { 52 [0]=> 53 int(%d) 54 [1]=> 55 string(2) "$a" 56 [2]=> 57 int(2) 58 } 59 [2]=> 60 array(3) { 61 [0]=> 62 int(%d) 63 [1]=> 64 string(1) " " 65 [2]=> 66 int(2) 67 } 68 [3]=> 69 string(1) "=" 70 [4]=> 71 array(3) { 72 [0]=> 73 int(%d) 74 [1]=> 75 string(1) " " 76 [2]=> 77 int(2) 78 } 79 [5]=> 80 array(3) { 81 [0]=> 82 int(%d) 83 [1]=> 84 string(1) "1" 85 [2]=> 86 int(2) 87 } 88 [6]=> 89 string(1) "," 90 [7]=> 91 array(3) { 92 [0]=> 93 int(%d) 94 [1]=> 95 string(1) " " 96 [2]=> 97 int(2) 98 } 99 [8]=> 100 array(3) { 101 [0]=> 102 int(%d) 103 [1]=> 104 string(2) "$b" 105 [2]=> 106 int(2) 107 } 108 [9]=> 109 array(3) { 110 [0]=> 111 int(%d) 112 [1]=> 113 string(1) " " 114 [2]=> 115 int(2) 116 } 117 [10]=> 118 string(1) "=" 119 [11]=> 120 array(3) { 121 [0]=> 122 int(%d) 123 [1]=> 124 string(1) " " 125 [2]=> 126 int(2) 127 } 128 [12]=> 129 array(3) { 130 [0]=> 131 int(%d) 132 [1]=> 133 string(1) "2" 134 [2]=> 135 int(2) 136 } 137 [13]=> 138 string(1) ";" 139 [14]=> 140 array(3) { 141 [0]=> 142 int(%d) 143 [1]=> 144 string(1) " 145" 146 [2]=> 147 int(2) 148 } 149 [15]=> 150 array(3) { 151 [0]=> 152 int(%d) 153 [1]=> 154 string(2) "$c" 155 [2]=> 156 int(%d) 157 } 158 [16]=> 159 array(3) { 160 [0]=> 161 int(%d) 162 [1]=> 163 string(1) " " 164 [2]=> 165 int(%d) 166 } 167 [17]=> 168 array(3) { 169 [0]=> 170 int(%d) 171 [1]=> 172 string(2) "+=" 173 [2]=> 174 int(%d) 175 } 176 [18]=> 177 array(3) { 178 [0]=> 179 int(%d) 180 [1]=> 181 string(1) " " 182 [2]=> 183 int(%d) 184 } 185 [19]=> 186 array(3) { 187 [0]=> 188 int(%d) 189 [1]=> 190 string(2) "$b" 191 [2]=> 192 int(%d) 193 } 194 [20]=> 195 string(1) ";" 196 [21]=> 197 array(3) { 198 [0]=> 199 int(%d) 200 [1]=> 201 string(1) " 202" 203 [2]=> 204 int(%d) 205 } 206 [22]=> 207 array(3) { 208 [0]=> 209 int(%d) 210 [1]=> 211 string(2) "$b" 212 [2]=> 213 int(4) 214 } 215 [23]=> 216 array(3) { 217 [0]=> 218 int(%d) 219 [1]=> 220 string(1) " " 221 [2]=> 222 int(4) 223 } 224 [24]=> 225 array(3) { 226 [0]=> 227 int(%d) 228 [1]=> 229 string(2) "-=" 230 [2]=> 231 int(4) 232 } 233 [25]=> 234 array(3) { 235 [0]=> 236 int(%d) 237 [1]=> 238 string(1) " " 239 [2]=> 240 int(4) 241 } 242 [26]=> 243 array(3) { 244 [0]=> 245 int(%d) 246 [1]=> 247 string(2) "$a" 248 [2]=> 249 int(4) 250 } 251 [27]=> 252 string(1) ";" 253 [28]=> 254 array(3) { 255 [0]=> 256 int(%d) 257 [1]=> 258 string(1) " 259" 260 [2]=> 261 int(4) 262 } 263 [29]=> 264 array(3) { 265 [0]=> 266 int(%d) 267 [1]=> 268 string(2) "$a" 269 [2]=> 270 int(5) 271 } 272 [30]=> 273 array(3) { 274 [0]=> 275 int(%d) 276 [1]=> 277 string(1) " " 278 [2]=> 279 int(5) 280 } 281 [31]=> 282 array(3) { 283 [0]=> 284 int(%d) 285 [1]=> 286 string(2) "*=" 287 [2]=> 288 int(5) 289 } 290 [32]=> 291 array(3) { 292 [0]=> 293 int(%d) 294 [1]=> 295 string(1) " " 296 [2]=> 297 int(5) 298 } 299 [33]=> 300 array(3) { 301 [0]=> 302 int(%d) 303 [1]=> 304 string(1) "2" 305 [2]=> 306 int(5) 307 } 308 [34]=> 309 string(1) ";" 310 [35]=> 311 array(3) { 312 [0]=> 313 int(%d) 314 [1]=> 315 string(1) " 316" 317 [2]=> 318 int(5) 319 } 320 [36]=> 321 array(3) { 322 [0]=> 323 int(%d) 324 [1]=> 325 string(2) "$d" 326 [2]=> 327 int(6) 328 } 329 [37]=> 330 array(3) { 331 [0]=> 332 int(%d) 333 [1]=> 334 string(1) " " 335 [2]=> 336 int(6) 337 } 338 [38]=> 339 array(3) { 340 [0]=> 341 int(%d) 342 [1]=> 343 string(2) "/=" 344 [2]=> 345 int(6) 346 } 347 [39]=> 348 array(3) { 349 [0]=> 350 int(%d) 351 [1]=> 352 string(1) " " 353 [2]=> 354 int(6) 355 } 356 [40]=> 357 array(3) { 358 [0]=> 359 int(%d) 360 [1]=> 361 string(5) "10.50" 362 [2]=> 363 int(6) 364 } 365 [41]=> 366 string(1) ";" 367 [42]=> 368 array(3) { 369 [0]=> 370 int(%d) 371 [1]=> 372 string(1) " 373" 374 [2]=> 375 int(6) 376 } 377 [43]=> 378 array(3) { 379 [0]=> 380 int(%d) 381 [1]=> 382 string(2) "$a" 383 [2]=> 384 int(7) 385 } 386 [44]=> 387 array(3) { 388 [0]=> 389 int(%d) 390 [1]=> 391 string(1) " " 392 [2]=> 393 int(7) 394 } 395 [45]=> 396 array(3) { 397 [0]=> 398 int(%d) 399 [1]=> 400 string(2) "%=" 401 [2]=> 402 int(7) 403 } 404 [46]=> 405 array(3) { 406 [0]=> 407 int(%d) 408 [1]=> 409 string(1) " " 410 [2]=> 411 int(7) 412 } 413 [47]=> 414 array(3) { 415 [0]=> 416 int(%d) 417 [1]=> 418 string(5) "10.50" 419 [2]=> 420 int(7) 421 } 422 [48]=> 423 string(1) ";" 424 [49]=> 425 array(3) { 426 [0]=> 427 int(%d) 428 [1]=> 429 string(1) " 430" 431 [2]=> 432 int(7) 433 } 434 [50]=> 435 array(3) { 436 [0]=> 437 int(%d) 438 [1]=> 439 string(2) "$b" 440 [2]=> 441 int(8) 442 } 443 [51]=> 444 array(3) { 445 [0]=> 446 int(%d) 447 [1]=> 448 string(1) " " 449 [2]=> 450 int(8) 451 } 452 [52]=> 453 array(3) { 454 [0]=> 455 int(%d) 456 [1]=> 457 string(2) "&=" 458 [2]=> 459 int(8) 460 } 461 [53]=> 462 array(3) { 463 [0]=> 464 int(%d) 465 [1]=> 466 string(1) " " 467 [2]=> 468 int(8) 469 } 470 [54]=> 471 array(3) { 472 [0]=> 473 int(%d) 474 [1]=> 475 string(2) "$c" 476 [2]=> 477 int(8) 478 } 479 [55]=> 480 string(1) ";" 481 [56]=> 482 array(3) { 483 [0]=> 484 int(%d) 485 [1]=> 486 string(1) " 487" 488 [2]=> 489 int(8) 490 } 491 [57]=> 492 array(3) { 493 [0]=> 494 int(%d) 495 [1]=> 496 string(2) "$c" 497 [2]=> 498 int(9) 499 } 500 [58]=> 501 array(3) { 502 [0]=> 503 int(%d) 504 [1]=> 505 string(1) " " 506 [2]=> 507 int(9) 508 } 509 [59]=> 510 array(3) { 511 [0]=> 512 int(%d) 513 [1]=> 514 string(2) "|=" 515 [2]=> 516 int(9) 517 } 518 [60]=> 519 array(3) { 520 [0]=> 521 int(%d) 522 [1]=> 523 string(1) " " 524 [2]=> 525 int(9) 526 } 527 [61]=> 528 array(3) { 529 [0]=> 530 int(%d) 531 [1]=> 532 string(1) "1" 533 [2]=> 534 int(9) 535 } 536 [62]=> 537 string(1) ";" 538 [63]=> 539 array(3) { 540 [0]=> 541 int(%d) 542 [1]=> 543 string(1) " 544" 545 [2]=> 546 int(9) 547 } 548 [64]=> 549 array(3) { 550 [0]=> 551 int(%d) 552 [1]=> 553 string(2) "$d" 554 [2]=> 555 int(10) 556 } 557 [65]=> 558 array(3) { 559 [0]=> 560 int(%d) 561 [1]=> 562 string(1) " " 563 [2]=> 564 int(10) 565 } 566 [66]=> 567 array(3) { 568 [0]=> 569 int(%d) 570 [1]=> 571 string(2) "^=" 572 [2]=> 573 int(10) 574 } 575 [67]=> 576 array(3) { 577 [0]=> 578 int(%d) 579 [1]=> 580 string(1) " " 581 [2]=> 582 int(10) 583 } 584 [68]=> 585 array(3) { 586 [0]=> 587 int(%d) 588 [1]=> 589 string(1) "5" 590 [2]=> 591 int(10) 592 } 593 [69]=> 594 string(1) ";" 595 [70]=> 596 array(3) { 597 [0]=> 598 int(%d) 599 [1]=> 600 string(1) " 601" 602 [2]=> 603 int(10) 604 } 605 [71]=> 606 array(3) { 607 [0]=> 608 int(%d) 609 [1]=> 610 string(2) "$a" 611 [2]=> 612 int(11) 613 } 614 [72]=> 615 array(3) { 616 [0]=> 617 int(%d) 618 [1]=> 619 string(1) " " 620 [2]=> 621 int(11) 622 } 623 [73]=> 624 array(3) { 625 [0]=> 626 int(%d) 627 [1]=> 628 string(3) ">>=" 629 [2]=> 630 int(11) 631 } 632 [74]=> 633 array(3) { 634 [0]=> 635 int(%d) 636 [1]=> 637 string(1) " " 638 [2]=> 639 int(11) 640 } 641 [75]=> 642 array(3) { 643 [0]=> 644 int(%d) 645 [1]=> 646 string(1) "1" 647 [2]=> 648 int(11) 649 } 650 [76]=> 651 string(1) ";" 652 [77]=> 653 array(3) { 654 [0]=> 655 int(%d) 656 [1]=> 657 string(1) " 658" 659 [2]=> 660 int(11) 661 } 662 [78]=> 663 array(3) { 664 [0]=> 665 int(%d) 666 [1]=> 667 string(2) "$b" 668 [2]=> 669 int(12) 670 } 671 [79]=> 672 array(3) { 673 [0]=> 674 int(%d) 675 [1]=> 676 string(1) " " 677 [2]=> 678 int(12) 679 } 680 [80]=> 681 array(3) { 682 [0]=> 683 int(%d) 684 [1]=> 685 string(3) "<<=" 686 [2]=> 687 int(12) 688 } 689 [81]=> 690 array(3) { 691 [0]=> 692 int(%d) 693 [1]=> 694 string(1) " " 695 [2]=> 696 int(12) 697 } 698 [82]=> 699 array(3) { 700 [0]=> 701 int(%d) 702 [1]=> 703 string(1) "2" 704 [2]=> 705 int(12) 706 } 707 [83]=> 708 string(1) ";" 709 [84]=> 710 array(3) { 711 [0]=> 712 int(%d) 713 [1]=> 714 string(1) " 715" 716 [2]=> 717 int(12) 718 } 719 [85]=> 720 array(3) { 721 [0]=> 722 int(%d) 723 [1]=> 724 string(2) "$d" 725 [2]=> 726 int(13) 727 } 728 [86]=> 729 array(3) { 730 [0]=> 731 int(%d) 732 [1]=> 733 string(1) " " 734 [2]=> 735 int(13) 736 } 737 [87]=> 738 array(3) { 739 [0]=> 740 int(%d) 741 [1]=> 742 string(2) ".=" 743 [2]=> 744 int(13) 745 } 746 [88]=> 747 array(3) { 748 [0]=> 749 int(%d) 750 [1]=> 751 string(1) " " 752 [2]=> 753 int(13) 754 } 755 [89]=> 756 array(3) { 757 [0]=> 758 int(%d) 759 [1]=> 760 string(13) ""hello world"" 761 [2]=> 762 int(13) 763 } 764 [90]=> 765 string(1) ";" 766 [91]=> 767 array(3) { 768 [0]=> 769 int(%d) 770 [1]=> 771 string(1) " 772" 773 [2]=> 774 int(13) 775 } 776 [92]=> 777 array(3) { 778 [0]=> 779 int(%d) 780 [1]=> 781 string(2) "?>" 782 [2]=> 783 int(14) 784 } 785} 786Done 787