IS there any way, i can write every new entry of a file always at the begging, not at the end? like if i do an fwrite($Handler,$line); , the $line will be put at the end of the file. i want it to be the first
Another option would be to use 'r+' for the fopen() mode, this will allow read, write and Prepend ie add to the beginning of the file
Yup, r+ is the easiest way. IE: <?php if ($file = fopen($pathToFile, 'r+')) { if (fwrite($file, $line) !== false) { // Success } else { // Failure } } ?> PHP: