<?php
require '../FirstOrderLogicProp.inc.php';
class FOLP_HTML extends FirstOrderLogicProp { function FOLP_HTML ($formula=NULL,$expand=FALSE) { parent::FirstOrderLogicProp($formula,$expand); } function printValuesTable ($border=1, $attrs='') { $formula = parent::toString(); $table = parent::valuesTable(); $vars = $table['vars']; $vals = $table['values']; echo '<table border="'.$border.'" '.$attrs.'>'; echo '<tr>'; foreach ($vars as $var) echo '<td align="center"><b style="color:darkblue">'.htmlentities($var).'</b></td>'; echo '<td align="center"><b style="color:darkred">'.htmlentities($formula).'</b></td></tr>'; foreach ($vals as $v) { echo '<tr>'; foreach ($vars as $var) echo '<td align="center"><span style="color:darkblue">'.htmlentities($v['values'][$var]).'</span></td>'; echo '<td align="center"><b style="color:darkred">'.$v['result'].'</b></td></tr>'; } echo '</table>'; } }
$formula = isset($_POST['formula']) ? $_POST['formula'] : '(a <!> c) & (b -> c)'; $p = new FOLP_HTML($formula); $p->addSyntaxFile('syntax.litteral'); $p->printValuesTable();
?>
|