vinkla / hashids

A small PHP library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database ids to the user.
https://hashids.org/php
MIT License
5.29k stars 417 forks source link

gmp_mod(): Unable to convert variable to GMP - wrong type #170

Closed abhiburk closed 3 years ago

abhiburk commented 3 years ago

I got this error while encoding a float value eg Hashids::encode(150.0);

But casting it is solving the problem

eg Hashids::encode(intval(150.0));

Could you help if it's a bug or Im doing it n a wrong way..

miquelfire commented 3 years ago

GMP doesn't do float values. What reason do you have for using float values in the first place?

vinkla commented 3 years ago

We only support integers at the current state of the project.

As always, thanks for helping out @miquelfire 🙌