Last active
October 26, 2016 08:43
-
-
Save michael34435/a5027403c3a6860ff210ea9aeafa9de9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment