How to convert a String to a unique INTEGER in php -


how can convert string(i.e. email address) unique integers, use them id.

the amount of information php integer may store limited. amount of information can store in string not (at least if string isn't unreasonably long.)

thus need compress arbitrary-length string non-arbitrary-length integer. impossible without data loss.

you may use hashing algorithm, hashing algorithms may have collisions. if want hash string integer collision probability pretty high - integers can store little data.

thus shall either stick email or use auto incrementing integer field.


Comments

Popular posts from this blog

c++ - Compiling static TagLib 1.6.3 libraries for Windows -

PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea -

asp.net - call stack missing info on mono with apache and mod_mono -