Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 295

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>crc32</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="String functions"
HREF="ref.strings.html"><LINK
REL="PREVIOUS"
TITLE="count_chars"
HREF="function.count-chars.html"><LINK
REL="NEXT"
TITLE="crypt"
HREF="function.crypt.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.count-chars.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.crypt.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.crc32"
></A
>crc32</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN89214"
></A
><P
>    (PHP 4 &#62;= 4.0.1)</P
>crc32&nbsp;--&nbsp;Calculates the crc32 polynomial of a string</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN89217"
></A
><H2
>Description</H2
>int <B
CLASS="methodname"
>crc32</B
> ( string str)<BR
></BR
><P
>&#13;     Generates the cyclic redundancy checksum polynomial of 32-bit
     lengths of the <TT
CLASS="parameter"
><I
>str</I
></TT
>. This is usually used
     to validate the integrity of data being transmitted.
    </P
><P
>&#13;     <DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
       Because PHP's integer type is signed, and many crc32 checksums will
       result in negative integers, you need to use the "%u" formatter of
       <A
HREF="function.sprintf.html"
><B
CLASS="function"
>sprintf()</B
></A
> or <A
HREF="function.printf.html"
><B
CLASS="function"
>printf()</B
></A
> to get
       the string representation of the unsigned crc32 checksum.
      </P
></BLOCKQUOTE
></DIV
>
     This second example shows how to print a converted checksum with the
     <A
HREF="function.printf.html"
><B
CLASS="function"
>printf()</B
></A
> function :
     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN89233"
></A
><P
><B
>Example 1. Displaying a crc32 checksum</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?php
$checksum = crc32("The quick brown fox jumped over the lazy dog.");
printf("%u\n", $checksum);
?&#62;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
><P
>&#13;     See also <A
HREF="function.md5.html"
><B
CLASS="function"
>md5()</B
></A
>
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.count-chars.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.crypt.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>count_chars</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.strings.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>crypt</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>