Created
May 4, 2013 12:29
-
-
Save ma4a/5517351 to your computer and use it in GitHub Desktop.
Only show the comments of a referred PHP file.
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 | |
| function commentworker($array, $s = '<br><br>') | |
| { | |
| if (is_array ($array)) | |
| { | |
| $output = ''; | |
| foreach ($array as $v) | |
| { | |
| $output .= commentworker($v, $s); | |
| } | |
| return '<pre>'.$output.'</pre>'; | |
| } | |
| else | |
| { | |
| return $array.$s; | |
| } | |
| } | |
| $file = file_get_contents('../myFile.php'); | |
| $matches = array(); | |
| preg_match_all('/\/\*\*(.*)\*\//smU', $file, $matches); | |
| $myoutput = commentworker($matches[0]); | |
| echo $myoutput; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment