code: protected function precedence($a, $b)
      {
          if (count($a) > count($b)) {
              $l = -1;
              $r = 1;
              $x = $a;
              $y = $b;
          } else {
              $l = 1;
              $r = -1;
              $x = $b;
              $y = $a;
          }
  
          foreach (array_keys($x) as $i) {
              if (false === isset($y[$i])) {
                  return $l;
              }
  
              if ($x[$i] === $y[$i]) {
                  continue;
              }
  
              $xi = is_integer($x[$i]);
              $yi = is_integer($y[$i]);
  
              if ($xi && $yi) {
                  return ($x[$i] > $y[$i]) ? $l : $r;
              } elseif ((false === $xi) && (false === $yi)) {
                  return (max($x[$i], $y[$i]) == $x[$i]) ? $l : $r;
              } else {
                  return $xi ? $r : $l;
              }
          }
  
          return 0;
      }
docs: Checks the precedence of each data set.
  
  @param array $a A data set.
  @param array $b A data set.
  
  @return integer -1 if $a > $b, 0 if $a = $b, 1 if $a < $b.