Skip to content

Instantly share code, notes, and snippets.

@RoelofWobben
Last active May 12, 2023 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RoelofWobben/4f11710a52dd8e01bfd2813625df76b9 to your computer and use it in GitHub Desktop.
Save RoelofWobben/4f11710a52dd8e01bfd2813625df76b9 to your computer and use it in GitHub Desktop.
[{
"resource": "/c:/xampp/htdocs/roelof/opdracht1/experimental.php",
"owner": "_generated_diagnostic_collection_name_#3",
"severity": 8,
"message": "'(' expected.",
"source": "php",
"startLineNumber": 10,
"startColumn": 11,
"endLineNumber": 10,
"endColumn": 11
}]
<?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">
<td>
<?php echo $data[0]; ?>
</td>
<td>
<?php echo $data[2] ?>;"<?php echo $data[1]; ?>
</td>
</tr>
</table>
</div>
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment