$code =<<<PHP_CODE
<?php
$str = "Hello, Tipi\n";
echo $str;
PHP_CODE;
var_dump(token_get_all($code));
array(10) { [0]=> array(3) { [0]=> int(379) [1]=> string(7) " int(1) } [1]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(2) } [2]=> string(1) "=" [3]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(2) } [4]=> array(3) { [0]=> int(323) [1]=> string(14) ""Hello, Tipi "" [2]=> int(2) } [5]=> string(1) ";" [6]=> array(3) { [0]=> int(382) [1]=> string(2) " " [2]=> int(3) } [7]=> array(3) { [0]=> int(328) [1]=> string(4) "echo" [2]=> int(4) } [8]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(4) } [9]=> string(1) ";" }