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