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