Morning,
I have a csv file and i want to do calculation. At first, i have already split the string into array.
I have retrieve two columns in my csv namely Head and SubHead.
I want to do the calculation of Head and SubHead in such format:
Row 1 of head multiply by Row 1 of SubHead
Continue until end of row.
if($out[1]=="*"||$out[1]=="/"||$out[1]=="+"||$out[1]=="-"){
$out1=$out[1];
if($out1=="*"){
$first=$out[0];
$second=$out[2];
foreach ($mycsv[0] as $key => $value) {
if (strcasecmp($value, $first) == 0) {
for ($row=0; $row < $row_length; $row++) {
if ($row == 0) {
echo "<tr>";
echo "<th colspan=100%>" . $mycsv[0][$key] . "</th>";
echo "</tr>";
} else {
$yes=$mycsv[$row][$key];
echo "<td>" . $yes . "</td>";
}
}
}
if (strcasecmp($value, $second) == 0) {
for ($row=0; $row < $row_length; $row++) {
if ($row == 0) {
echo "<tr>";
echo "<th colspan=100%>" . $mycsv[0][$key] . "</th>";
echo "</tr>";
} else {
$yes2=$mycsv[$row][$key];
echo "<td>" . $yes2 . "</td>";
}
}
}
}
}
Note: $out[1] is the Math operators.
Thanks for helping.