note 36582 modified in function.crc32 by vrana

From: Date: Tue, 17 Aug 2004 14:55:50 +0000
Subject: note 36582 modified in function.crc32 by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79935@lists.php.net to get a copy of this message
This function returns the unsigned crc32 value. I realized it's not very obvious from the current documentation. <?php /** * Function to compute the unsigned crc32 value. * PHP crc32 function returns int which is signed, so in order to get the correct crc32 value * we need to convert it to unsigned value. * * @param $str - String to compute the unsigned crc32 value. * @return $var - Unsinged inter value. */ function computeUnsignedCRC32($str){ sscanf(crc32($str), "%u", $var); return $var; } ?> --was-- This function returns the unsigned crc32 value. I realized it's not very obvious from the current documentation. /** * Function to compute the unsigned crc32 value. * PHP crc32 function returns int which is signed, so in order to get the correct crc32 value * we need to convert it to unsigned value. * * @param $str - String to compute the unsigned crc32 value. * @return $var - Unsinged inter value. */ function computeUnsignedCRC32($str){ sscanf(crc32($str), "%u", $var); return $var; } http://php.net/manual/en/function.crc32.php

« previous php.notes (#79935) next »