$string = "abcde"; $file = file_get_contents($myfile); if ($string_is_the_first_five_chars_of_a_line){ replace that line with $string.$string2; }else{ add $string.$string2 to the end }
WhosAWhata
5:52 pm on Aug 13, 2004 (gmt 0)
look at explode() foreach() ereg() ereg_replace()
WebNeeds
5:54 pm on Aug 13, 2004 (gmt 0)
i'm sorry but i don't really know PHP, could someone give me a boost?
jatar_k
9:56 pm on Aug 13, 2004 (gmt 0)
well, since file_get_contents returns the whole file as one big string what about substr
if ($string == substr($file0,5)) { etc ...
but are you trying to read it line by line or just as a single string?