i got a text file that contains
a b c
a c
b
i want to read the text file and convert it to array of arrays like this
array(
array('a', 'b', 'c'),
array('a', 'c'),
array('b'));
i want to split each line in an array and each word in a index in the array
i tried this code but it only split each line in a array i want each word in a array of the line
$file="140724.txt";
$fopen = fopen($file, r);
$fread = fread($fopen,filesize($file));
fclose($fopen);
$remove = "\n";
$split = explode($remove, $fread);
$array[] = null;
$tab = "\t";
foreach ($split as $string)
{
$row = explode($tab, $string);
array_push($array,$row);
}
echo "<pre>";
print_r($array);
echo "</pre>";
i got this result
Array
(
[0] =>
[1] => Array
(
[0] => a b c
)
[2] => Array
(
[0] => a b
)
[3] => Array
(
[0] => c
))