Code: Select all
<?php
$fileContent = file_get_contents("Product/tblPmixDetail");
//Convert Windows CR to Linux
$fileContent = str_replace("\r\n","\n",$fileContent);
//Split file by finding right CR.
$expr="/\n(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/";
$rows=preg_split($expr,trim($fileContent));
unset($fileContent); //Free up some memory
$data = array();
foreach($rows as $row){
//Find right coma
$expr="/,(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/";
$results = preg_split($expr,trim($row));
//Remove quote
$data[] = preg_replace("/\"(.*)\"/s","$1",$results);
}
//Free up some memory
unset($rows);
$count = count($data);
for ($i = 0; $i < $count; $i++) {
unset ($data[$i][0,1,3,4,5,6,7,8,9,10,12,13]); <------Is this right?
}
//Show the result
echo "<pre>";
print_r($data);
echo "</pre>";
?>
Hence [0,1,2,3,4.......] The numbers are names of the other arrays
Is that not correct?