sed 's/\(\/\/\|#\).*$//g' YOUR_FILENAME | sed '/^$/N;/^\s*$/D'
Edit:
sed 's/\(\/\/\|#\).*$//g' YOUR_FILENAME | sed '/^$/N;/^\s*$/D' To clarify, that strips comments and multiple blank lines. Generally comments are a good idea. I would not remove them or create shorter names for functions and variables for performance. Any benefit there is minuscule beyond belief. Your comments trolled me into giving that answer, seriously though: remove your comments.
Ignoring the Comments - some real recommendations
Consistency makes things easier to read.
- Work out your maximum line length and use it (especially for the comments).
- Stop trolling me with mixed brace styles in if
if/elseelsestatements.
make_checks is not a very descriptive name for a function. It would be better as check_libraries.
Now, the bit of your code that actually does something:
$type = ( substr($file, -4, 1) !== '.' ) // Can you see? ? substr($file, -4) // Can you see my genius. : substr($file, -3) // It's shining... ; // oh so bright. What a marvelous function, I // couldn't have done it better myself. Oh, wait. Should be rewritten:
$type = pathinfo($file, PATHINFO_EXTENSION);
$type = pathinfo($file, PATHINFO_EXTENSION); In fact, the variables $file$file and $type$type are only used once (and hence shouldn't even be variables).