sfchun
04-29-2008, 11:01 AM
Hello
I opened a file in a variable
and I'm searching for the code to delete (or replace with blank) a line
which contain a specific word/string, the rest of the line is generated and can be different each time.
example :
assuming :
- what is generated randomly is in red
- what i search is in green (and it normaly seen only once in the file)
$file = "1031hc023blablabla461hjk0456"
How i can delete this line ?? (from the string and not the file/string).
Is there a simple code line ? or should i count the line as if it was a file ??
Can i use something like : str_replace or preg_replace ??
I couldn't find an example doing this on the web :(
someone help ?
I opened a file in a variable
and I'm searching for the code to delete (or replace with blank) a line
which contain a specific word/string, the rest of the line is generated and can be different each time.
example :
assuming :
- what is generated randomly is in red
- what i search is in green (and it normaly seen only once in the file)
$file = "1031hc023blablabla461hjk0456"
How i can delete this line ?? (from the string and not the file/string).
Is there a simple code line ? or should i count the line as if it was a file ??
Can i use something like : str_replace or preg_replace ??
I couldn't find an example doing this on the web :(
someone help ?