Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // read file as string
- $data = file_get_contents("func.php");
- // tokenize
- $tokens = token_get_all($data);
- // iterate tokens
- $_f = false;
- $methods = array();
- foreach ($tokens as $token) {
- $token_name = token_name((int)$token[0]);
- if ("T_FUNCTION" == $token_name) {
- $_f = true;
- }
- if ("T_STRING" == $token_name && true == $_f) {
- $methods[] = $token[1];
- $_f = false;
- }
- }
- // output
- echo "<pre>".print_r($methods, true)."</pre>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment