code: private static function encryptWithPHP71($K, $key_length, $IV, $P = null, $A = null, $tag_length = 128)
      {
          $mode = 'aes-'.($key_length).'-gcm';
          $T = null;
          $C = openssl_encrypt($P, $mode, $K, OPENSSL_RAW_DATA, $IV, $T, $A, $tag_length / 8);
          Assertion::true(false !== $C, 'Unable to encrypt the data.');
  
          return [$C, $T];
      }
docs: @param string      $K          Key encryption key
  @param string      $key_length Key length
  @param string      $IV         Initialization vector
  @param null|string $P          Data to encrypt (null for authentication)
  @param null|string $A          Additional Authentication Data
  @param int         $tag_length Tag length
  
  @return array