1--TEST-- 2Test token_get_all() function : basic functionality 3--SKIPIF-- 4<?php if (!extension_loaded("tokenizer")) print "skip"; ?> 5--FILE-- 6<?php 7echo "*** Testing token_get_all() : basic functionality ***\n"; 8 9// with php open/close tags 10$source = '<?php echo "Hello World"; ?>'; 11echo "-- source string with PHP open and close tags --\n"; 12var_dump( token_get_all($source) ); 13 14// without php open/close tags testing for T_INLINE_HTML 15$source = "echo 'Hello World';"; 16echo "-- source string without PHP open and close tags --\n"; 17var_dump( token_get_all($source) ); 18 19echo "Done" 20?> 21--EXPECTF-- 22*** Testing token_get_all() : basic functionality *** 23-- source string with PHP open and close tags -- 24array(7) { 25 [0]=> 26 array(3) { 27 [0]=> 28 int(%d) 29 [1]=> 30 string(6) "<?php " 31 [2]=> 32 int(1) 33 } 34 [1]=> 35 array(3) { 36 [0]=> 37 int(%d) 38 [1]=> 39 string(4) "echo" 40 [2]=> 41 int(1) 42 } 43 [2]=> 44 array(3) { 45 [0]=> 46 int(%d) 47 [1]=> 48 string(1) " " 49 [2]=> 50 int(1) 51 } 52 [3]=> 53 array(3) { 54 [0]=> 55 int(%d) 56 [1]=> 57 string(13) ""Hello World"" 58 [2]=> 59 int(1) 60 } 61 [4]=> 62 string(1) ";" 63 [5]=> 64 array(3) { 65 [0]=> 66 int(%d) 67 [1]=> 68 string(1) " " 69 [2]=> 70 int(1) 71 } 72 [6]=> 73 array(3) { 74 [0]=> 75 int(%d) 76 [1]=> 77 string(2) "?>" 78 [2]=> 79 int(1) 80 } 81} 82-- source string without PHP open and close tags -- 83array(1) { 84 [0]=> 85 array(3) { 86 [0]=> 87 int(%d) 88 [1]=> 89 string(19) "echo 'Hello World';" 90 [2]=> 91 int(1) 92 } 93} 94Done 95