note 34139 modified in function.crc32 by danbrown
| From: | danbrown@php.net | Date: | Thu, 06 Oct 2011 21:42:49 +0000 |
| Subject: | note 34139 modified in function.crc32 by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183693@lists.php.net to get a copy of this message | ||
This is a really simple way of displaying the crc-32 hexadecimal code/checksum for a file...
(absolute paths are more reliable)
<?php
$file = "http://example.com/bar.jpg";
// Read the file into an array
$data = file($file);
// Join the array into a string
$data = implode('', $data);
// Calculate the crc
$crc = crc32($data);
//convert from decimal to hexadecimal
$crchex=DecHex($crc*1);
//echo the result
echo "$crchex";
?>
--was--
This is a really simple way of displaying the crc-32 hexadecimal code/checksum for a file...
(absolute paths are more reliable)
<?
$file = "http://foo.net/bar.jpg";
// Read the file into an array
$data = file($file);
// Join the array into a string
$data = implode('', $data);
// Calculate the crc
$crc = crc32($data);
//convert from decimal to hexadecimal
$crchex=DecHex($crc*1);
//echo the result
echo "$crchex";
?>
http://php.net/manual/en/function.crc32.php