Re: Stable may require unstable ?

From: Date: Sun, 30 Jan 2005 23:27:05 +0000
Subject: Re: Stable may require unstable ?
References: 1 2 3 4 5  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-2403@lists.php.net to get a copy of this message
self rsponse
As far as I can check here I don't find any, but my search doesn't work :( (I tried grep again ...)
Better this way: <?php if (!defined('T_ML_COMMENT')) { define('T_ML_COMMENT', T_COMMENT); } else { define('T_DOC_COMMENT', T_ML_COMMENT); } $script = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1]: 'example.php'; $source = file_get_contents($script); $tokens = token_get_all($source); $cnt = $out =0; foreach ($tokens as $token) { if (is_string($token)) {
       if ($out) {
           echo $token;
           if ($token == ';') {
               // include is finished
               $out = 0;
           }
       }
} else {
       // token array
       list($id, $text) = $token;
       switch ($id) {
           case T_COMMENT:
           case T_ML_COMMENT:
           case T_DOC_COMMENT:
           case T_WHITESPACE:
               // no action on comments nor white spaces
               break;
           case T_INCLUDE:
           case T_INCLUDE_ONCE:
           case T_REQUIRE:
           case T_REQUIRE_ONCE:
               // anything required -> output "as is"
               echo "\n{$text}: ";
               $out=1;
               $cnt++;
               break;
           default:
               if ($out) {
                   echo token_name($id).'->'.$text.' ';
               }
       }
} } echo "\n{$cnt} inc/req found\n"; ?> I go on, à+ -- bertrand Gugger (toggg)

« previous php.pear.qa (#2403) next »