$prepend = 'prepend me please';
$file="/path/to/file";
$fileContents = file_get_contents($file);
file_put_contents($file, $prepend . $fileContents);
More Related Contents:
- Adding files cookies PHP (host)
- How do I save the output of this code into a file? (PHP) [closed]
- How do I add PHP code/file to HTML(.html) files?
- How can one check to see if a remote file exists using PHP?
- Getting the names of all files in a directory with PHP
- How to delete a line from the file with php?
- PHP, get file name without file extension
- Reading very large files in PHP
- Encrypting / Decrypting file with Mcrypt
- PHP script to loop through all of the files in a directory?
- PHP list of specific files in a directory
- Get the current script file name
- Efficiently counting the number of lines of a text file. (200mb+)
- PHP: How to check if image file exists?
- php glob – scan in subfolders for a file
- HTTP requests with file_get_contents, getting the response code
- Least memory intensive way to read a file in PHP
- How to limit file upload type file size in PHP?
- PHP: Force file download and IE, yet again
- PHP filesize MB/KB conversion [duplicate]
- Laravel 5.3 multiple file uploads
- How to test if a user has SELECTED a file to upload?
- PHP see only 20 uploading files at a time
- overriding upload_max_filesize
- File creation time [closed]
- Create new XML file and write data to it?
- Get the hierarchy of a directory with PHP
- move all files in a folder to another?
- Read and write to a file while keeping lock
- PHP Undefined index error $_FILES?