I want to open CSV (comma separated value) file in PHP by column, i want to take all datas from 3 columns. I tried with this code, but this only shows me data by row:
$row = 1;
if (($handle = fopen("ut.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
echo "<p> $num fields in line $row: <br /></p>\n";
$row++;
for ($c=0; $c < $num; $c++) {
echo $data[$c] . "<br />\n";
}
}
fclose($handle);
}
How i can take all datas from one column ?
EXAMPLE: This i my file in Excel, which is exported to SCV: http://prntscr.com/mzcfcw
I want to take in php values from colum Name and Price and find duplicate values in column Name, compare their prices.
array_count_values: php.net/manual/en/function.array-count-values.php