I'm making a table with Boostrap
and PHP
to do odd and even numbers I'm doing it in for
but I do not know why it does not print odd and even.
I do not know much of Boostrap
with PHP
.
With this for
I generate it but it does not print me in pairs or odd
for($i=1; $i<10; $i++)
{
echo "<tr>";
echo "<td>".$i."</td>";
echo "<td>".(11-$i)."</td>";
echo "<td>".($i%2==0)."</td>";
echo "<td>".($i%2 !=0)."</td>";
echo "<td>".$i."</td>";
echo "</tr>";
}
?>
I introduced
<!DOCTYPE html>
<html lang="en">
<head>
<title>Este ejercicio es del for</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Basic Table</h2>
<p>The .table class adds basic styling (light padding and only horizontal dividers) to a table:</p>
<table class="table">
<thead>
<th>1 a 10</th>
<th>10 a 1</th>
<th> par </th>
<th> impar </th>
<th> 5 en 5 </th>
</thead>
<tbody>
<?php
for($i=1; $i<10; $i++)
{
echo "<tr>";
echo "<td>".$i."</td>";
echo "<td>".(11-$i)."</td>";
echo "<td>".($i%2)."</td>";
echo "<td>".($i%2 !=0)."</td>";
echo "<td>".$i."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</body>
</html>