PHP golfing tips: Reading/writing files and the CLI
You can read a line from STDIN in 13 characters:

fgets(STDIN);


as seen here.

Reading from a file:

file('filename')


returns an array of lines of the file.

Using fputs instead of fwrite will save a character on writing, but I can't think of a shorter way than:

fputs(fopen('filename','w')); //use 'a' if you're appending to a file instead of overwriting


which is marginally shorter than:

file_put_contents('filename');