mhash_count

int mhash_count(void) 

Gets the number of hash IDs.

Returns:

Integer representing the number of hash IDs

Description:

mhash_count() gets the maximum number of hash IDs. Numbering of hashes starts at 0. Using this value, it’s possible to get a list of all available hashes, as shown in the following example.

Version:

Existing since versions 3.0.9 and 4.0

Example:

Print the names of available hash algorithms
<?php 
$hashcount = mhash_count(); 
for ($i = 0; $i <= $hashcount; $i++) {
    printf("%s\n",mhash_get_hash_name($i)); 
} 
?> 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.