O'Reilly logo
  • isaac peraza thinks this is interesting:

/** * Custom array comparison method * @param array $a * @param array $b * @return int */ function compareArrays(array $a, array $b) { $sumA = array_sum($a); $sumB = array_sum($b); if ($sumA == $sumB ){ return 0; } elseif ($sumA > $sumB){ return 1; } else { return -1; } }

From

Cover of PHPUnit Essentials

Note

Good Unit Test Example - Testing compareArrays() function