token_get_all
(PHP 4 >= 4.2.0, PHP 5)
token_get_all -- 指定したソースをPHPトークンに分割する
説明
array
token_get_all ( string source )
token_get_all()は指定した文字列
sourceをパースし、Zend engineの字句解析スキャ
ナによりPHP言語のトークンに分割します。この関数は、トークンの配列を
返します。配列の各要素には、1文字単位の文字列またはトークンIDとソー
スコードの中のトークンの文字列表現を含む配列が含まれます。
例 1. token_get_all()の例
<?php $tokens = token_get_all(";"); // => array(";"); $tokens = token_get_all("foreach") // => array(T_FOREACH => "foreach"); $tokens = token_get_all("/* comment */") // => array(T_ML_COMMENT => "/* comment */"); ?>
|
|