Created
May 12, 2023 08:27
-
-
Save RoelofWobben/c037b7f7df1424bb17dc2515bad24391 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ONLY FOR TESTING | |
error_reporting(E_ALL); | |
function readCsvFile (): array { | |
$rows = []; | |
if (($handle = fopen("stock.csv", "r")) !== FALSE) { | |
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { | |
$rows[] = $data; | |
} | |
fclose($handle); | |
} | |
return $rows; | |
}; | |
$data = readCsvFile(); | |
function displayCSVData() { | |
?> | |
<div class="phppot-container"> | |
<table class="striped"> | |
<thead> | |
<tr> | |
<th>Symbol</th> | |
<th>Price</th> | |
<th>Symbol</th> | |
</tr> | |
</thead> | |
<tr class="data"> | |
<?php | |
foreach ($data as $row) { | |
?> | |
<td> | |
<?php echo $row[0]; ?> | |
</td> | |
<td> | |
<?php echo $row[2]; ?>"<?php echo $row[1]; ?> | |
</td> | |
} | |
</tr> | |
</table> | |
</div> | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment