Step 1: get and read the manual.
You don't have to spend years on it, just read the intro and look at a few code examples.
Now, move to the filesystem functions. Read about the file() functions and what it does.
Easy enough, $my_file=file("filename");
That gives you an array filled with the lines of text from your file.
We want to look at every element of the array we just made.
So, first we need to know how many elements there are in this array.
Move to the array_functions section of the manual, look at the count() function.
count($my_file)
tells us how many entries there are in this array.
Now we have the data, we know how much data we have, how do we get to the data?
In an array you can adres data like this: $my_file[$item_counter]
If I need the first element in the array:
$my_file[0];
then 5th:
$my_file[4];
Now how do I know which element is the one I want to delete?
Go to the control-structures and string_functions section.
Look up IF and SRTCMP
You can imagine it must look something like this:
if (strcmp($my_file,"this is the text I want to delete"))
{
delete the entry
};
Now we want to do this for every entry, go back to the control structures, look up the FOR statement.
for (condition)
{
do this
};
Now we have allmost everything we need:
for ($item_counter=0;$item_counter<count($my_file);$irem_counter++)
{
if (strcmp($my_file[$item_counter],"this is the line I want to delete"))
{
delete the entry
};
};
That should get you started, I'll leacve the most insteresting part (the array_splice()) for you to figure out.....
evil grin