Writing a file to disk behind the scenes in PHP