Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $fileStr = file_get_contents(YOUR_PHP_FILE_PATH);
- $fileContent = "";
- $commentTokens = [T_COMMENT];
- $commentTokens[] = defined('T_DOC_COMMENT') ? T_DOC_COMMENT : T_ML_COMMENT;
- $tokens = token_get_all($fileStr);
- foreach ($tokens as $token) {
- if (is_array($token)) {
- if (in_array($token[0], $commentTokens))
- continue;
- $token = $token[1];
- }
- $fileContent .= $token;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement