Skip to content

Commit

Permalink
Update AhmadFadhilah.php
Browse files Browse the repository at this point in the history
Add if else and for function
  • Loading branch information
ahmadfadhilah32 authored Oct 19, 2021
1 parent afe241f commit 28a136a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions AhmadFadhilah.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,31 @@

<table class="tic-tac-toe" cellpadding="0" cellspacing="0">
<tbody>

<?php
$lastRow = 0;
for ($i = 1; $i <= 9; $i++) {
$row = ceil($i / 3);

if ($row !== $lastRow) {
$lastRow = $row;

if ($i > 1) {
echo "</tr>";
}

echo "<tr class='row-{$row}'>";
}

$additionalClass = '';

if ($i == 2 || $i == 8) {
$additionalClass = 'vertical-border';
}
else if ($i == 4 || $i == 6) {
$additionalClass = 'horizontal-border';
}
else if ($i == 5) {
$additionalClass = 'center-border';
}
?>

0 comments on commit 28a136a

Please sign in to comment.