Paste the code:
Phperror_reporting(E_all& ~E_notice); $expression=$_get[' truetable '];//reading input box data if(!Empty($_get[' Truetable '])){ $expression=Strtoupper($expression);//Replace the lowercase letter entered with an uppercase letter $EXPRESSIONARR=Str_split($expression);//convert $expression to an array foreach($EXPRESSIONARR as $v){//Put the letters in the $varTotal array if($v>= ' A ' &&$v<= ' Z '){ $varTotal[]=$v; } } $varTotal=Array_unique($varTotal);//remove repeated letters from the $vartotal array Sort($varTotal);//alphabetical Ordering of $varTotal arrays $varTotal 1=Preg_replace("/([A-z])/", "$\\1",$varTotal);//$varTotal 1 The letters in the array become variables $maxN=Count($varTotal); //$EXPRESSIONARR = Preg_replace ("/([A-z])/", "$\\1", $EXPRESSIONARR);//$EXPRESSIONARR The letters in the array become variables $newExpression=implode('',$EXPRESSIONARR);//$expressionArr array becomes a string//echo $newExpression. "
"; $newExpression=Preg_replace("/([A-z])-([A-z])/", "!\\1|\\2",$newExpression); $newExpression=Preg_replace("/(\ (. *?\))-([A-z])/", "!\\1|\\2",$newExpression); $newExpression=Preg_replace("/(\ (. *?\)), (. *?) /","!\\1|\\2 ",$newExpression); $newExpression=Preg_replace("/([A-z]), (. *?) /","!\\1|\\2 ",$newExpression); $EXPRESSIONARR=Str_split($newExpression);//convert $expression to an array $EXPRESSIONARR=Preg_replace("/([A-z])/", "$\\1",$EXPRESSIONARR); $newExpression=implode('',$EXPRESSIONARR); //echo $newExpression; }?>
<title>Truth Table Query 1.0 by: Xiao Zhen</title> Truth Table Query 1.0 by: Xiao Zhen
[Description: Disjunction (|), Hop (&), non (!), implied (-), equivalent (=)]
Echo; ifEmpty$_get])){ foreach$varTotal as$v){ Echo; } Echo; $resultPOW$maxN); for$i$i$result$i){ $resultN$isprintf$maxNDecbin$i)); $resultN$iStr_split$resultN$i]); } foreach$resultN as$k$v){ Echo; foreach$resultN$k as$k 1$v 1){ Echo; $varTotal 2$k 1$varTotal 1$k 1$v 1; //echo $varTotal 2[$k 1]. " ";Eval$varTotal 2$k 1); } //echo $newExpression;Eval$newExpression); foreach$varTotal 3 as$k 2$v){ if$vNULL){ $varTotal 3$k 2; } } Echo; Echo; } //Print_r ($varTotal 3); }
PHP "
"(! ([' Truetable ' ("
{$v} | " "
Results | "= (2, (=0;<;++[]= ("%0{}d ", [[]=] ([=]
"([] ="
". $v 1. " | "[]=[]." =". ([].";" ("\ $varTotal 3[] =".. ";" (= = (==[]=0 "
". $varTotal 3 [$k]. " | " "
"?>
The above describes the PHP version of the truth table-truevaluetable, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.