Remove Documentation PHP Script

amr1991

New Member
Messages
396
Reaction score
0
Points
0
Here is what I'm doing, I'm making a script that will take input of php code and then read through it and if any line starts with // it will erase the whole line. I only need to know if there is a function already to remove a line in PHP, or something of that sort
 

Cynical

Active Member
Messages
3,492
Reaction score
0
Points
36
Nope, I haven't heard of anything like that... but remember: commenting is usually there for a reason. People don't just add it in randomly to bloat up their files.
 

Torch

New Member
Messages
634
Reaction score
0
Points
0
Actually, there's a php_strip_whitespace function which will remove whitespace and comments from a given php file. You can use it like this:
PHP:
<? php_strip_whitespace("somefile.php") ?>
For something more advanced you could use regexps (eg. ereg()) or maybe substr, in while loop. If you like I could make you a function like that, but I'm not sure if I'll have time in a next day or so. But, in any case I think that built in php_strip_whitespace function will suffice for what you need.
 

Trixter

New Member
Messages
384
Reaction score
0
Points
0
Never heard of someone trying to get rid of commenting!!! lol

but i suppose you could write a program to do it. or use GVIM to do it fast.
 

amr1991

New Member
Messages
396
Reaction score
0
Points
0
@Torch

Torch you are a pro at PHP lol. Every reply you had for help with PHP for me worked :biggrin:

@Trixter

Thanks for the cool program :cool:
 
Top