[21:15:58] <+irCuBiC> well, you do $handle = fopen("filename", "a+") to get a file opened in "append" mode, then fwrite($handle, $line) to add the line at the end(hopefully with an added "\n"), then fclose($handle) to close it
[21:16:20] <+irCuBiC> and $contents = file_get_contents("filename"); to get all the lines
[21:17:05] <+irCuBiC> this is all very short, but I presume you know how to read the manual for more info =P
[21:18:20] <+irCuBiC> you'd probably want to split the contents up to get the lines [$contents = split("\n", $contents);]