array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'function.gmp-hamdist.php', 1 => 'gmp_hamdist', ), 'up' => array ( 0 => 'ref.gmp.php', 1 => 'GMP İşlevleri', ), 'prev' => array ( 0 => 'function.gmp-gcdext.php', 1 => 'gmp_gcdext', ), 'next' => array ( 0 => 'function.gmp-import.php', 1 => 'gmp_import', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/gmp/functions/gmp-hamdist.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp_hamdist — Hamming distance
Returns the hamming distance between num1
and
num2
. Both operands should be non-negative.
The hamming distance between num1
and num2
, as an int.
Örnek 1 gmp_hamdist() example
<?php
$ham1 = gmp_init("1001010011", 2);
$ham2 = gmp_init("1011111100", 2);
echo gmp_hamdist($ham1, $ham2) . "\n";
/* hamdist is equivalent to: */
echo gmp_popcount(gmp_xor($ham1, $ham2)) . "\n";
?>
Yukarıdaki örneğin çıktısı:
6 6