$filename = 'itunes_report.txt';
$f = fopen($filename, 'r');
$db = array();
$dbSize = 0;
$var = file($filename);
$mydata = trim($var[1]);
$temp = explode(" ", $mydata);
print_r($temp);
i read data from a file using this code. i was take the first line from the text file.
this is the line
APPLE US ebookReaderipad EC Media (International) Pvt. ltd BooksOnwink 1.3 1F 1 0 07/30/2012 08/05/2012 GBP GB GBP 425105344 0
i explode this line using white spaces. Then some white spaces are missing in output.
out put
Array ( [0] => APPLE US ebookReaderipad EC [1] => Media [2] => (International) [3] => Pvt. [4] => ltd BooksOnwink 1.3 1F 1 0 07/30/2012 08/05/2012 GBP GB GBP 425105344 0 )
Your input seem to be is tab
\tdelimited, you can split on"\t":or if you are really mean to split on every whitespace, try using a more flexible spit with regexps:
This will split on everything considered whitespace and consume sequence of whitespaces too.