Update example according to PHP 5.2.2 (Line numbers are returned in element 2):
<?php $tokens = token_get_all('<?php echo; ?>'); /* array ( array ( 0 => 367, 1 => '<?php ', 2 => 1 ), array ( 0 => 316, 1 => 'echo', 2 => 1 ), ';', array ( 0 => 370, 1 => ' ', 2 => 1 ), array ( 0 => 369, 1 => '?>', 2 => 1 ) ) */ /* Note in the following example that the string is parsed as T_INLINE_HTML rather than the otherwise expected T_COMMENT (T_ML_COMMENT in PHP <5). This is because no open/close tags were used in the "code" provided. This would be equivalent to putting a comment outside of <?php ?> tags in a normal file. */ $tokens = token_get_all('/* comment */'); // array ( array ( 0 => 311, 1 => '/* comment */', 2 => 1 ) ) ?>