$file = fopen("example.txt", "r"); echo fread($file,filesize("example.txt")); fclose($file);
$file = fopen("example.txt", "w"); $content = "Hello, world!"; fwrite($file, $content); fclose($file);In this example, we use the fopen() function to open the "example.txt" file with write mode. Then we use the fwrite() function to write the content "Hello, world!" to the file. Finally, we close the file using the fclose() function. The PHP Filesystem (File) Library is a built-in package in PHP and does not require any additional installation.