Hi guys,
Just curious, what is the best way to remove a certain line from a file?
The file that is involved has a data per line, so I guess putting them in an array would be the best idea.
$data = file($filename);
So is there a way to remove a certain array element and shift the entire array up by one (cos i do not want to leave a blank line after deleting)?
I don't think unset() can do as it does not shift the entire array back up, and now i am thinking of array_splice(), but i am not too sure if that will work the way i like it to be.
Any other suggestions? Or any I stuck with array_splice()?
Also what if I want to remove a collection of lines? Like lines 5 to 10? or 12-20? Ahh I think I will worry about removing a collection of lines later 🙂.