Consider the content of your text.txt
file
FristLineFirstData FirstLineSecondData FirstLineThirdData SecondLineFirstData SecondLineSecondData SecondLineThirdData
Tab separed.
And the script :
<?php
$file = "text.txt";// Your Temp Uploaded file
$handle = fopen($file, "r"); // Make all conditions to avoid errors
$read = file_get_contents($file); //read
$lines = explode("\n", $read);//get
$i= 0;//initialize
foreach($lines as $key => $value){
$cols[$i] = explode("\t", $value);
$i++;
}
echo "<pre>";
print_r($cols); //explore results
echo "</pre>";
?>
will return
Array ( [0] => Array ( [0] => FristLineFirstData [1] => FirstLineSecondData [2] => FirstLineThirdData ) [1] => Array ( [0] => SecondLineFirstData [1] => SecondLineSecondData [2] => SecondLineThirdData ) )