How do I change the file() in this code to be fopen() and work? Reason being, my text file is over 10,000 lines long.
Help is greatly appreciated! =)
Code: Select all
function NextLine() {
$textfile = "links.txt";
if(file_exists($textfile)){
$sites = file($textfile, FILE_SKIP_EMPTY_LINES);
if(!empty($sites)) {
$string = array_shift($sites);
file_put_contents($textfile, implode($sites));
} else {
$string = " ";
}
} else {
$string = "Error";
};
return $string;
}
$s0 = NextLine();
echo "$s0";
Shane