'.htmlspecialchars($text).""); }else { die('no file specified'); } function strip_comments($fileStr) { $newStr=''; $commentTokens = array(T_COMMENT); //if (defined('T_DOC_COMMENT')) //$commentTokens[] = T_DOC_COMMENT; // PHP 5 $tokens = token_get_all($fileStr); foreach ($tokens as $token) { if (is_array($token)) { if (in_array($token[0], $commentTokens)) continue; $token = $token[1]; } $newStr .= $token; } return $newStr; }