Return to Snippet

Revision: 17439
at September 4, 2009 15:40 by dygor


Initial Code
function hash($input)
  {
  //Create unsigned crc
  $input=abs(crc32(serialize($input)));

  //Build a string representing the crc32
  $result="";
  while ($input > 0)
     {
     //Use only a-z
     $result.=chr( ($input % 26) + 97);

     //Decrease value
     $input=$input >> 2;
     }
  //Done 
  return($result);
  }

Initial URL

                                

Initial Description
convert any value into an id-string

Initial Title
convert (nearly) any value into an id-string

Initial Tags

                                

Initial Language
PHP