Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- function trueTable($x1, $x2, $x3, $x4) {
- return implication(disjunction($x4, invers($x3, $x2)), xor2($x2, disjunction($x3, implication($x1, $x2)))) ? 1 : 0;
- }
- function disjunction($x1, $x2) {
- return $x1 || $x2;
- }
- function conjunction($x1, $x2) {
- return $x1 && $x2;
- }
- function xor2($x1, $x2) {
- return $a xor $b;
- }
- function invers($x1, $x2) {
- return !$x2;
- }
- function implication($x1, $x2) {
- return $x1 && !$x2 ? false : true;
- }
- ?>
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>№3</title>
- <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootswatch/3.1.1/flatly/bootstrap.min.css">
- </head>
- <body>
- <div class="container">
- <table class="table table-striped">
- <thead>
- <th>X1</th>
- <th>X2</th>
- <th>X3</th>
- <th>X4</th>
- <th>F</th>
- </thead>
- <tbody>
- <?
- for($x1 = 0; $x1 <= 1; $x1++) {
- for($x2 = 0; $x2 <= 1; $x2++) {
- for($x3 = 0; $x3 <= 1; $x3++) {
- for($x4 = 0; $x4 <= 1; $x4++) {
- ?>
- <tr>
- <td><?=$x1?></td>
- <td><?=$x2?></td>
- <td><?=$x3?></td>
- <td><?=$x4?></td>
- <td><?=trueTable($x1, $x2, $x3, $x4)?></td>
- </tr>
- <?
- }
- }
- }
- }
- ?>
- </tbody>
- </table>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement