You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
coffee-table/index.php

32 lines
756 B

<?php
namespace Coffee;
require __DIR__ . '/vendor/autoload.php';
try {
$map = [
[0, 1, 0, 1],
[1, 0, 0, 0],
[0, 0, 0, 1],
[0, 0, 1, 1]
];
$table = new Table($map);
echo '<table>';
foreach ($table->getDescription() as $rowIndex => $row) {
echo '<tr>' . "\n";
foreach ($row as $columnIndex => $column) {
$position = new Position($rowIndex + 1, $columnIndex + 1);
echo '<td>' . $table->getSpotNumberByPosition($position) . '</td>' . "\n";
}
echo '</tr>' . "\n";
}
echo '</table>';
}
catch (\Exception $e) {
// TODO: provide more information, like the file:line for example
echo 'Caught exception: ' . $e->getMessage() . "\n";
}