Solved

php decimal hash wanted: like md5() but should only return numbers

Posted on 2008-06-18
5
1,174 Views
Last Modified: 2008-06-19
Hello,

I want a PHP function to return a 10 digit hash that only contains numbers.  I cannot use MD5 because it returns the letters a through d as well as numbers.
0
Comment
Question by:hankknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
Alex-w474 earned 500 total points
ID: 21818435
You can use crc32: http://php.net/manual/en/function.crc32.php
printf('%u', crc32($text));

Open in new window

0
 
LVL 49

Expert Comment

by:Roonaan
ID: 21820159
have you tried:

$hash = rand(1000000000,9999999999);
0
 
LVL 5

Expert Comment

by:Alex-w474
ID: 21820363
>have you tried:
>$hash = rand(1000000000,9999999999);

It is not a hash as per it is.
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 21820386
Yeah, sorry. That's just a random number.
0
 
LVL 16

Author Comment

by:hankknight
ID: 21822702
Alex-w474.

crc32 meets my needs perfectly.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question