how to read BIG files using fseek (above 2GB+, upto any size like 4GB+, 100GB+, 100 terabyes+, any file size, 100 petabytes, max limit is php_float_max ) ?
// seek / set file pointer to 50 GB
my_fseek($fp, floatval(50000000000),1);
function my_fseek($fp,$pos,$first=0) {
// set to 0 pos initially, one-time
if($first) fseek($fp,0,SEEK_SET);
// get pos float value
$pos=floatval($pos);
// within limits, use normal fseek
if($pos<=PHP_INT_MAX)
fseek($fp,$pos,SEEK_CUR);
// out of limits, use recursive fseek
else {
fseek($fp,PHP_INT_MAX,SEEK_CUR);
$pos -= PHP_INT_MAX;
my_fseek($fp,$pos);
}
}
hope this helps.