TrueValueTable and logical expression of truth table in php

Source: Internet
Author: User
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" ";} Echo" "; $ 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" "; $ 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" "; Echo" ";}// Print_r ($ varTotal3) ;}?>
{$ V}Result
". $ V1 ."". $ VarTotal3 [$ k]."

Why? Php error_reporting (E_ALL ~ E_NOTICE); $ expression = $ _ GET ['truetable']; // read the data in the input box...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.