I need to make script that reads a file delimite by pipes "|" in with binary search without using memory ram. How can I do it?
I tried:
$handle = fopen("myfile.txt", "r");
if ($handle) {
while (($line = fgets($handle)) !== false) {
// while reads line make binary search
}
fclose($handle);
} else {
// error opening the file.
}
myfile.txt
Name|Title|Andrew|TheBook1|July|TheChest|Carol|OneTime
yield), see here. Yielding lines have a low memory footprint.yieldcan be useful here? The$lineis overwritten in each iteration.