Home / PHP Tips Generated By ChatGPT / Using file_get_contents() and file_put_contents() in PHP Read from and write to files in a simple manner. Source Code $content = file_get_contents('example.txt'); // Read file file_put_contents('example.txt', 'Hello, World!'); // Write to file