<?php /* hexdec.php */

/* 4.1.0 branch hexdec not compatible
 * with earlier PHP releases.
 */

/*

% php4.0.0 -f hexdec.php
lemon => 5d08374e => 1560819534
pineapple => a7e9b7d0 => -1477855280
fruit => c10d50e3 => -1056091933
sausage => 42d08254 => 1120961108
breakfast => f7d7b86e => -136857490
coconut => 1138ca81 => 288934529

% php4.0.6 -f hexdec.php
lemon => 5d08374e => 1560819534
pineapple => a7e9b7d0 => -1477855280
fruit => c10d50e3 => -1056091933
sausage => 42d08254 => 1120961108
breakfast => f7d7b86e => -136857490
coconut => 1138ca81 => 288934529

% php4.1.0RC5 -f hexdec.php
lemon => 5d08374e => 1560819534
pineapple => a7e9b7d0 => 2817112016
fruit => c10d50e3 => 3238875363
sausage => 42d08254 => 1120961108
breakfast => f7d7b86e => 4158109806
coconut => 1138ca81 => 288934529

*/

$wordlist = array("lemon", "pineapple", "fruit", "sausage",
                                  "breakfast","coconut");

foreach($wordlist as $word) {
        $crc = mhash(MHASH_CRC32, $word);
        $hex = bin2hex($crc);
        $dec = hexdec($hex);
        echo $word . " => " . $hex . " => " . $dec . "\n";
}

?>

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to