All pastes #1945933 Raw Edit

Unnamed

public text v1 · immutable
#1945933 ·published 2010-09-21 16:52 UTC
rendered paste body
	<html>
		<head></head>
		<body>
		    <form method=POST>
		    	<input type=text name="se1" value"sets of value 1 are here">
		    		<b>1st Set</b><br>
		    	<input type=text name="se2" value"sets of value 2 are here">
				<b>2nd Set</b><br><br>
		    	<input type=text name="uni" value"sets of value 2 are here">
		    	<b>Universal Set</b><br>
		    	<input type="submit" value="GO!"><br>
		    		<?php
		    		    $se1=$_POST["se1"];
		    		    $se2=$_POST["se2"];
		    		    $uni=$_POST["uni"];
		    		    
		    		    
		    		    $split1 = $se1;
		    		    $arse1 = split("[,]+", $split1);
		    		    
		    		    $split2 = $se2;
		    		    $arse2 = split("[,]+", $split2);
		    		     
		    		    $split3 = $uni;
		    		    $arse3 = split("[,]+", $split3);
		    		    
		    		     function array_union($arse1, $arse2) {
  							$union = array_merge($arse1, $arse2);
  							$union = array_unique($union);
							return $union;}
							
						

						 $first = $arse1;
						 $second = $arse2;
						 $final = $arse3;
						 $union = array_union($first, $second);
						 $inter = array_intersect($first, $second);
						 $dif1 = array_diff($first, $second);
						 $dif2 = array_diff($second, $first);
						 $dif3 = array_diff($final, $first);
						 $dif4 = array_diff($final, $second);
						
						 
						 	$parting1= implode (',', $union);
						 	$count1= count($union);
						 		
		    		    
						 	$parting2= implode (',', $inter);
						 	$count2= count($inter);
		    		    
							 $parting3= implode (',', $dif1);
							 $count3= count($dif1);
		    		    
						 	$parting4= implode (',', $dif2);
						 	$count4= count($dif2);
		    		    
							 $parting5= implode (',', $dif3);
						 	$count5= count($dif3);
		    		    
							 $parting6= implode (',', $dif4);
						 	$count6= count($dif4);
						 	
						 	
						 	 echo '<i>UNION:</i><br>'.'{'.$parting1.'}';
		    		     	echo '<i><br>Absolute Union:</i><br>'.'/'.$count1.'/<br>';
							 echo '<i>INTERSECTION:</i><br>'.'{'.$parting2.'}';
		    		     	echo '<br>'.'/'.$count2.'/';
							 echo '<i>RELATIVE DIFFERENCE <b>Set1-Set2</b></i><br>'.'{'.$parting3.'}';
		    		     	echo '<br>'.'/'.$count3.'/';
		    		     	 echo '<i>RELATIVE DIFFERENCE <b>Set2-Set1</i><br>'.'{'.$parting4.'}';
		    		     	echo '<br>'.'/'.$count4.'/';
		    		     	 echo '<i>COMPLEMENT OF <b>U-Set1</b></i><br>'.'{'.$parting5.'}';
		    		     	echo '<br>'.'/'.$count5.'/';
		    		    	echo '<i>COMPLEMENT OF <b>U-Set2</b></i><br>'.'{'.$parting6.'}';
		    		     	echo '<br>'.'/'.$count6.'/';
		    		      	 
		    		     
		    		    
		    		?>

		    </form>
		</body>
	</html>