Hi all,
Sombody know a php script how eraise a specific lines from file
(e.g. i want to delete the lines from line 91 to line 100 from test.txt)
I searched on Google and found a script that delete only one line. i need to eraise multiple line (specific line)
Thank you!
Remove lines from file
Moderator: General Moderators
- Grizzzzzzzzzz
- Forum Contributor
- Posts: 125
- Joined: Wed Sep 02, 2009 8:51 am
Re: Remove lines from file
the first result on google when searching for "php delete by line number":
http://www.phpro.org/examples/Delete-Li ... -File.html
http://www.phpro.org/examples/Delete-Li ... -File.html
Re: Remove lines from file
I know this script
but this script delete only one line
I need to delete multiple line ( eg. line 91, 67, 98...)
but this script delete only one line
I need to delete multiple line ( eg. line 91, 67, 98...)
- Grizzzzzzzzzz
- Forum Contributor
- Posts: 125
- Joined: Wed Sep 02, 2009 8:51 am
Re: Remove lines from file
put a loop into it?
eg:
eg:
Code: Select all
$linesToDelete = array("1","2","3");
$i = 0;
while($linesToDelete[$i])
{
delLineFromFile($fileName, $linesToDelete[$i]);
$i++;
}
Re: Remove lines from file
is work..thank you