I have one tab delimited text file (TXT) with more than 1 million lines(records) and around 400 MB file size
Example
demo 123333 new
demo2 3444442 new
demo4 56666632 old
demo5 455552333 new
So now I want to find out line which 2nd tab is equal to "56666632"
also convert all tab value of that line covert into array like :
data[0]=>demo4
data[1]=>56666632
data[2]=>old
Note : I want without while and foreach because very large number of line in txt file
I am try this code with while loop:
$file = "feed.txt";
$cols = array();
ini_set('auto_detect_line_endings', true);
$fh = fopen($file, 'r');
while (($line = fgetcsv($fh, 1000, "\t")) !== false)
{
if($line[1]=="56666632")
{
var_dump($line);
break;
}
}