Location: PHPKode > scripts > Quine-McCluskey Method > quine-mccluskey-method/index.php
<?php
/*
* PHP5 Application
* Author: Armin Randjbar-Daemi
* Demo: http://www.omnistream.co.uk/qm/
*/
if (!empty($_POST['vari'])&&!empty($_POST['minterm'])&&$_POST['vari']<"100"&&strlen($_POST['minterm'])<"100"&&strlen($_POST['dontcare'])<"100")
	{
		$vari=addslashes(trim($_POST['vari']));
		$minterm=addslashes(trim($_POST['minterm']));

		if (!empty($_POST['dontcare'])||$_POST['dontcare']=="0"){
			$dontcare=" ".addslashes(trim($_POST['dontcare']));
		}else{
			$dontcare="";
		}
		include("./QM.class.php");
		include("./Chronometer.php");
		$chrono = new Chronometer();
		$chrono->start();
			$QM=new QM($vari,$minterm,$dontcare);
		$chrono->stop();
			
			for($p=0;$p<count($QM->essentialPrimes);$p++)
				echo $QM->essentialPrimes[$p]."<br />";//show final result
				
		echo "<font color=\"#c30606\">execution&nbsp;time:&nbsp;".$chrono->show()."&nbsp;&#956;s</font>"; 
	}
?>
<br /><br />
<form action="index.php" method="post">
<br />Minterms: <input type=text name="minterm" />
<br />DontCares: <input type=text name="dontcare" />
<br />Variables: <input type=text name="vari" />
<br /><input type=submit value="ok" name="ok" />
</form>
Return current item: Quine-McCluskey Method