I'm trying to convert a csv to table with following code:
<?PHP
$file_handle = fopen("data/points.csv", "r");
while (!feof($file_handle) ) {
$line_of_text = fgetcsv($file_handle, 1024);
echo '<tr><td>' . $line_of_text[0] . '</td><td>' . $line_of_text[1] . '</td><td>' . $line_of_text[2] . '</td><td>' . $line_of_text[3] . '</td><td>' . $line_of_text[4] . '</td></tr>';
}
fclose($file_handle);
?>
</table>
Now I want to add conditionality like:
if $line_of_text[2] <0
add fontawesome icon fa fa-caret-down and text should be red
if $line_of_text[2] >0
add fontawesome icon fa fa-caret-up and text should be green
How can I achieve this?