Guest User

Untitled

a guest
Jan 31st, 2012
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. <?php
  2.  
  3.     // read file as string
  4.     $data = file_get_contents("func.php");
  5.    
  6.     // tokenize
  7.     $tokens = token_get_all($data);
  8.    
  9.     // iterate tokens
  10.     $_f = false;
  11.     $methods = array();
  12.     foreach ($tokens as $token) {
  13.         $token_name = token_name((int)$token[0]);
  14.         if ("T_FUNCTION" == $token_name) {
  15.             $_f = true;
  16.         }
  17.         if ("T_STRING" == $token_name && true == $_f) {
  18.             $methods[] = $token[1];
  19.             $_f = false;
  20.         }
  21.     }
  22.    
  23.     // output
  24.     echo "<pre>".print_r($methods, true)."</pre>";
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment