I\'m trying to read a file line by line. The problem is the file was too big(over 500000 line) and I reach out the memory limit. I wonder how to read the file without being
You can set the memory limit like ini_set('memory_limit',-1)
;//You script will not stoped until its finished the reading. but this is wrong way beacuse its take your CPU utilization time on server.
Better is to divide the file in chunks,
covert you file data to array then you can easily read it in chunks like
$file_lines = file('mytext.txt');
foreach ($file_lines as $line) {
echo $line;
}
$file_lines is your array.