The tokenizer functions provide an interface to the
PHP tokenizer embedded in the Zend Engine. Using these
functions you may write your own PHP source analyzing
or modification tools without having to deal with the
language specification at the lexical level.
Beginning with PHP 4.3.0 these functions are enabled by default.
For older versions you have to configure and compile PHP with
--enable-tokenizer. You can disable
tokenizer support with --disable-tokenizer.
The windows version of PHP has built in
support for this extension. You do not need to load any additional
extension in order to use these functions.
Note:
Builtin support for tokenizer is available with PHP 4.3.0.
The constants below are defined by this extension, and
will only be available when the extension has either
been compiled into PHP or dynamically loaded at runtime.
Here is a simple example PHP scripts using the tokenizer that
will read in a PHP file, strip all comments from the source
and print the pure code only.
Example 1. Strip comments with the tokenizer
<?php /* * T_ML_COMMENT does not exist in PHP 5. * The following three lines define it in order to * preserve backwards compatibility. * * The next two lines define the PHP 5 only T_DOC_COMMENT, * which we will mask as T_ML_COMMENT for PHP 4. */ if (!defined('T_ML_COMMENT')) { define('T_ML_COMMENT', T_COMMENT); } else { define('T_DOC_COMMENT', T_ML_COMMENT); }
token_name -- Get the symbolic name of a given PHP token
Php ref.tokenizer Function syntax tag
ref.tokenizer php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online
Php ref.tokenizer syntax tutorial
php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.