Jump to content
php.lv forumi

parveidot binari


Sephy

Recommended Posts

crc32 nav nekāda sakara ar mīnuszīmēm. Tas atgriež pilnu 32-bitīgu integeri, ar kuru tu tālāk vari darīt, kas vien tev ietīkas.

 

hmm paskaties kaut vai shadu piemeru:

 

<?php 

$ciparz = "13337";
$parveidotais = crc32($ciparz);
echo "parveidots ar crc32 $parveidotais";

?>

 

ja izvada to parveidoto vismaz man sanak -771315054. un man tas minus neparak patik ;P

Link to comment
Share on other sites

Manuāli vajag rūpīgāk lasīt:

Because PHP's integer type is signed, and many crc32 checksums will result in negative integers, you need to use the "%u" formatter of sprintf() or printf() to get the string representation of the unsigned crc32 checksum.

Link to comment
Share on other sites

×
×
  • Create New...