TrueValueTable, the true table logical expression of the php expression. TrueValueTable, which is the logical expression of the truth table in php? Phperror_reporting (E_ALL ~ E_NOTICE); $ expression $ _ GET [TrueTable]; TrueValueTable-TrueValueTable: TrueValueTable, logical expression of the php expression used to read data from the input box
= 'A' & $ v <= 'Z') {$ varTotal [] = $ v ;}}$ varTotal = array_unique ($ varTotal ); // remove the repeated letters sort ($ varTotal) in the $ varTotal array; // sort the letters in the $ varTotal array in positive order $ varTotal1 = preg_replace ("/([A-Z])/", "$ \ 1", $ varTotal); // change the letter in the $ varTotal1 array to the variable $ maxN = count ($ varTotal ); // $ expressionArr = preg_replace ("/([A-Z])/", "$ \ 1", $ expressionArr ); // change the letter in the $ expressionArr array to the variable $ newExpression = implode ('', $ expressionArr); // $ expressionArr array to 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;}?> Truth table query 1.0 BY: Xiao Zhen $ _ GET ['truetable']?> "/>
[Description: extract (|), Union (&), non (!) , Meaning (->), equivalent (=)]
Php echo"
"; If (! Empty ($ _ GET ['truetable']) {foreach ($ varTotal as $ v) {echo"
| {$ V} | ";} Echo"
Result | "; $ Result = pow (2, $ maxN); for ($ I = 0; $ I <$ result; $ I ++) {$ resultN [$ I] = sprintf ("% 0 {$ maxN} d", decbin ($ I )); $ resultN [$ I] = str_split ($ resultN [$ I]);} foreach ($ resultN as $ k = >$ v) {echo"
"; Foreach ($ resultN [$ k] as $ k1 => $ v1) {echo"
| ". $ V1 ." | "; $ VarTotal2 [$ k1] = $ varTotal1 [$ k1]. "= ". $ v1; // echo $ varTotal2 [$ k1]. ""; eval ($ varTotal2 [$ k1]. ";") ;}// echo $ newExpression; eval ("\ $ varTotal3 [] = ". $ newExpression. ";"); foreach ($ varTotal3 as $ k2 = >$ v) {if ($ v = NULL) {$ varTotal3 [$ k2] = 0 ;}} echo"
". $ VarTotal3 [$ k]." | "; Echo"
";}// Print_r ($ varTotal3) ;}?>
Why? Php error_reporting (E_ALL ~ E_NOTICE); $ expression = $ _ GET ['truetable']; // read the data in the input box...