How to move file pointer to the end of the file in PHP

1 Answer

0 votes
/*
int fseek ( resource $handle , int $offset [, int $whence = SEEK_SET ] )
*/

$fp = fopen('e:/test.txt', 'r');
echo fgets($fp, 5) . "<br />";

// move back to the end of the file
fseek($fp, 0, SEEK_END);

echo fgets($fp, 5) . "<br />";
fclose($fp);
    
/*
run:

PHP 

*/

 



answered Dec 14, 2015 by avibootz
...