Speed up development with full-stack environments for every branch.

Learn More

How to use token_get_all with PHP Tokenizer

Forked from Hello World.

1269 Runs 2635 Views 438 Copies
Saved

Saved

gtsolutions 373

gtsolutions
published 4 years ago

<pre>
    <?php
    /*
     * PHP Tokenizer - token_get_all
     * token_get_all() parses the given source string into PHP language tokens using the Zend engine's lexical scanner. 
     */
    $code = '<?php echo "Hello World!"; ?>';
    $tokens = token_get_all($code);
    var_dump($tokens);
    ?>
</pre>
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).