php-doc-en/reference/tokenizer/functions/token-get-all.xml

56 lines
1.7 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<refentry id="function.token-get-all">
<refnamediv>
<refname>token_get_all</refname>
<refpurpose>Split given source into PHP tokens</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>token_get_all</methodname>
<methodparam><type>string</type><parameter>source</parameter></methodparam>
</methodsynopsis>
<para>
<function>token_get_all</function> parses the given <parameter>source</parameter>
string into PHP language tokens using the Zend engines lexical scanner.
The function returns an array of token descriptions. Each array element itself is
either a one character string or itself an array containing a token id and the
string representation of that token in the source code.
</para>
<example>
<title><function>token_get_all</function> example</title>
<programlisting role="php">
<![CDATA[
<?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 */")
?>
]]>
</programlisting>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->