Skip to content

Instantly share code, notes, and snippets.

@ReinierC
Last active January 5, 2018 16:05
Show Gist options
  • Save ReinierC/3541460356ea71c008572bdc10b24514 to your computer and use it in GitHub Desktop.
Save ReinierC/3541460356ea71c008572bdc10b24514 to your computer and use it in GitHub Desktop.
PHP math table

RC Logo

A math table

Creates a math table using PHP and HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PHP math table</title>
</head>
<body>
<h2>PHP Math table</h2>
<?php
$numbers =array();
$multiplications =array();
$raisedToThePowerThree =array();
for($i = 1; $i <= 10; $i++){
$numbers[] = $i;
}
for($i = 1; $i <= 10; $i++){
$multiplications[] = $i * $i;
}
for($i = 1; $i <= 10; $i++){
$raisedToThePowerThree[] = $i * $i * $i;
}
?>
<table border =\"1\" style='border-collapse: collapse'>
<?php
for($i = 1; $i <= 10; $i++) {
?>
<tr>
<td><?= $numbers[$i]?></td>
<td><?= $multiplications[$i]?></td>
<td><?= $raisedToThePowerThree[$i]?></td>
</tr>
<?php
}
?>
</table>
<br/>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment