Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

The metaphone algorithm, invented by Lawrence Philips, was first described in
Computer Language magazine. You may find a discussion of metaphone at Scott Gasch's
Algorithm Archive http://perl.guru.org/alg/node131.html.


<?
print("Atkinson encodes as ". metaphone("Atkinson"));
?>


string mhash(integer hash, string data)


Use mhash to get a hash for a string. Hashing algorithms available at the time of writing
are shown in Table 9.2.


Refer to the Mhash documentation for more information about each algorithm.


<?
print(mhash(MHASH_GOST, "Who is John Galt?"));
?>


Table 9.2. Mhash Algorithms
MHASH_CRC32
MHASH_CRC32B


MHASH_GOST
MHASH_HAVAL
MHASH_MD5
MHASH_RIPEMD128
MHASH_RIPEMD160
MHASH_SHA1


MHASH_TIGER


integer mhash_count()


The mhash_count function returns the highest-numbered hash identifier. All hash
algorithms are numbered from zero, so you can use this function and
mhash_get_hash_name to get a complete list.


<?
print("<TABLE BORDER=\"1\">\n");


print("\n");
print("Algorithm\n");
print("Block Size\n");
print("\n");

Free download pdf