array_diff function - how to compare two or more arrays in php
array_difffunction.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>array_diff function - how to compare two or more arrays in php</title>
</head>
<body>
<h2 style="color:Navy; font-style:italic">php example: using aarray_diff function in php</h2>
<hr width="500" align="left" color="DodgerBlue" />
<br />
<?php
$ColorsList1=array("Red","Green","Blue","Tan");
$ColorsList2=array("Red","Green","Snow","Tan");
print_r($ColorsList1);
echo "<br /><br />";
print_r($ColorsList2);
echo "<br /><br />";
echo "Colors only present in first array";
echo "<br />";
echo "<div style='font-size:large;color:OrangeRed'>";
print_r(array_diff($ColorsList1,$ColorsList2));
echo "</div>";
?>
</body>
</html>