Often times I have to compare ridiculous lists of computers. hundreds of computer names. What's in list a that's not in list b etc. I HATE Excel, just going to put that out there. The word hate isn't even sufficient enough, honestly. php is a much more elegant solution, even when its not elegant. This is a single page tool that uses the URL to maintain the arrays. The nice thing about this is by saving the URL you can reload the comparisons later. There's no risk of sql injection attacks or anything it's just using php functions to compare text. Enjoy...

 

COMPARATOR 1.0

Use this tool to give you some variations of two separate lists. Paste text only into the fields. Items should be separated by a space.

-List 1 Name



-List 2 Name




use this button to go to a separate page for just this tool



. Count: 1


Count: 1


Items in that are not in . Count: 0


Items in that are not in . Count: 0


Items that are in both arrays. Count: 1





Array ( [0] => )
Array ( [0] => )
Array ( )
Array ( [0] => )

 

 Here's the source code if you're interested in playing with this program. Help yourself. This was a fast and dirty assembly, just to get the job done.

<html>
<h1>COMPARATOR 1.0</h1>
<p>Use this tool to give you some variations of two separate lists. Paste text only into the fields. Items should be separated by a space.</P>
<?php
$list1Name = ($_POST['list1Name']);
$serverlist1 = strtolower($_POST['serverlist1']);
$list2Name = ($_POST['list2Name']);
$serverlist2 = strtolower($_POST['serverlist2']);
?>

<form method="POST">

<input type="text" name="list1Name" size="50" value="<?php echo $list1Name ?>"> -List 1 Name<br/><br/>
<input type="text" name="serverlist1" size="400" value="<?php echo $serverlist1 ?>"><br/>
<br/>
<input type="text" name="list2Name" size="50" value="<?php echo $list2Name ?>"> -List 2 Name<br/><br/>
<input type="text" name="serverlist2" size="400" value="<?php echo $serverlist2 ?>"><br/>
<input type="submit" value="Compare"/><br/>
</form>

<form action="/tools/comparator.php?">
<input type="submit" value="reset">
</form>

<?php

$array1 = (explode(" ",$serverlist1));
echo "<br/>";
$array2 = (explode(" ",$serverlist2));

$arrlength1=count($array1);
echo "$list1Name . Count: ".$arrlength1."<br/>";
for($x=0;$x<$arrlength1;$x++)
{
echo $array1[$x];
echo "<br>";
}
echo "<hr/>";

$arrlength2=count($array2);
echo "$list2Name Count: ".$arrlength2."<br/>";
for($x=0;$x<$arrlength2;$x++)
{
echo $array2[$x];
echo "<br>";
}


$diffresult1 = array_values(array_diff($array1,$array2));

echo "<hr/>";
$arrlength3=count($diffresult1);
echo "<p>Items in <b> $list1Name </b> that are not in <b>$list2Name</b>. Count: ". $arrlength3 ."</p>";

for($x=0;$x<$arrlength3;$x++)
{
echo $diffresult1[$x];
echo "<br>";
}

$diffresult2 = array_values(array_diff($array2,$array1));

echo "<hr/>";
$arrlength4=count($diffresult2);
echo "<p>Items in <b>$list2Name</b> that are not in <b>$list1Name</b>. Count: ". $arrlength4 ."</p>";

for($x=0;$x<$arrlength4;$x++)
{
echo $diffresult2[$x];
echo "<br>";
}

$intersect = array_values(array_intersect($array1,$array2));

echo "<hr/>";
$arrlength5=count($intersect);
echo "<p>Items that are in both arrays. Count: ". $arrlength5 ."</p>";

for($x=0;$x<$arrlength5;$x++)
{
echo $intersect[$x];
echo "<br>";
}

echo "<hr/>";
echo "<br/>";
echo "<br/>";
print_r($array1);
echo "<br/>";
print_r($array2);
echo "<br/>";
print_r($diffresult1);
echo "<br/>";
print_r($intersect);
echo "<br/>";
?>
</body>
</html>