fork download
  1. <?php
  2. function a($a, $b) {
  3. $a1 = 0;
  4. $b1 = 0;
  5. for ($i = 0; $i < count($a); $i++) {
  6. if ($a[$i] > $b[$i]) $a1++;
  7. if ($a[$i] < $b[$i]) $b1++;
  8. }
  9. return [$a1, $b1];
  10. }
  11. $a = [5, 6, 7];
  12. $b = [3, 6, 10];
  13. var_dump(a($a, $b));
  14.  
  15. //https://pt.stackoverflow.com/q/438915/101
Success #stdin #stdout 0.02s 24212KB
stdin
Standard input is empty
stdout
array(2) {
  [0]=>
  int(1)
  [1]=>
  int(1)
}