Skip to content

Instantly share code, notes, and snippets.

@BraveSirRobin
Created June 4, 2011 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BraveSirRobin/1008378 to your computer and use it in GitHub Desktop.
Save BraveSirRobin/1008378 to your computer and use it in GitHub Desktop.
Simple demo of token_get_all()
<?php
$php = "<html><head><?php include '/foo/bar/php'; ?></head>....";
foreach (token_get_all($php) as $tok) {
if (is_array($tok)) {
printf("token type %s: %s\n", token_name($tok[0]), $tok[1]);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment