code: public static function isList($array)
      {
          if (!is_array($array)) {
              return false;
          }
  
          $expected = 0;
          foreach ($array as $key => $unused) {
              if ($key !== $expected++) {
                  return false;
              }
          }
          return true;
      }
docs: Checks whether the given argument is a list (vector array)
  
  An empty array is considered both a list and a map.
  
  @param mixed $array
  @return bool