PHP 8.1.15 Released!

hash_copy

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

hash_copyCopy hashing context

Descrição

hash_copy(HashContext $context): HashContext

Parâmetros

context

Hashing context returned by hash_init().

Valor Retornado

Returns a copy of Hashing Context.

Changelog

Versão Descrição
7.2.0 Accept and return HashContext instead of resource.

Exemplos

Exemplo #1 hash_copy() example

<?php
$context
= hash_init("md5");
hash_update($context, "data");

/* copy context to be able to continue using it */
$copy_context = hash_copy($context);

echo
hash_final($context), "\n";

hash_update($copy_context, "data");
echo
hash_final($copy_context), "\n";
?>

O exemplo acima irá imprimir:

8d777f385d3dfec8815d20f7496026dc
511ae0b1c13f95e5f08f1a0dd3da3d93

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top