Comparing Arrays: equality, identity, and the difference
<?php
function array_eq_ident($arr1, $arr2) {
printf("<p>The two arrays are %sequal.</p>\n", $arr1 == $arr2 ? '' : 'not ');
printf("<p>The two arrays are %sidentical.</p>\n", $arr1 === $arr2 ? '' : 'not ');
}
$dogs = array('A' => 'C', 'B' => 'D', 'X' => 'Z', 'Q' => 'T');
$pups = array('A' => 'C', 'B' => 'D', 'X' => 'Z', 'Q' => 'T');
array_eq_ident($dogs, $pups);
?>
Related examples in the same category