Home :: International :: Manuals :: Howto :: FAQ :: Man Pages :: Email Login

 
 

 

gmp_hamdist

(PHP 4 >= 4.0.4, PHP 5)

gmp_hamdist -- Distance de Hamming

Description

int gmp_hamdist ( resource a, resource b)

gmp_hamdist() retourne la distance de Hamming entre a et b. Les deux paramètres doivent être strictement positifs.

Exemple 1. Exemple avec gmp_hamdist()

<?php
$ham1
= gmp_init("1001010011", 2);
$ham2 = gmp_init("1011111100", 2);
echo
gmp_hamdist($ham1, $ham2) . "\n";

/* hamdist est équivalent à : */
echo gmp_popcount(gmp_xor($ham1, $ham2)) . "\n";
?>

L'exemple ci-dessus va afficher :

6
6

Voir aussi gmp_popcount() et gmp_xor().

 
 
 
 
Google
  Web Linuxinfor   
 

Home :: Copyright :: Privacy :: Credits :: Get a free Linuxinfor Email Account

Document on this page is part of "Manuel PHP". See Index Page for more info about Authorship and Copyright.

1999-2009 Linuxinfor.com. No rights reserved.