src/AESGCM.php
public static function decryptWithAppendedTag($K, $IV, $Ciphertext = null, $A = null, $tag_length = 128)
    {
        $tag_length_in_bits = $tag_length / 8;
        $C = mb_substr($Ciphertext, 0, -$tag_length_in_bits, '8bit');
        $T = mb_substr($Ciphertext, -$tag_length_in_bits, null, '8bit');

        return self::decrypt($K, $IV, $C, $A, $T);
    }
public static function decryptWithAppendedTag($K, $IV, $Ciphertext = null, $A = null, $tag_length = 128)
    {
        $tag_length_in_bits = $tag_length / 8;
        $C = mb_substr($Ciphertext, 0, -$tag_length_in_bits, '8bit');
        $T = mb_substr($Ciphertext, -$tag_length_in_bits, null, '8bit');

        return self::decrypt($K, $IV, $C, $A, $T);
    }
This method should be used if the tag is appended at the end of the ciphertext.
It is used by some AES GCM implementations such as the Java one.

@param string      $K          Key encryption key
@param string      $IV         Initialization vector
@param string|null $Ciphertext Data to encrypt (null for authentication)
@param string|null $A          Additional Authentication Data
@param int         $tag_length Tag length

@return string

@see self::encryptAndAppendTag