Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP encoding to only have letters and numbers

Tags:

php

Is there a encoding function in PHP which will encode strings and the resulting output will only contain letters and numbers? I would use base64 but that still has some stuff which is not numeric/alphanumeric

like image 337
cappuccino Avatar asked Oct 26 '25 12:10

cappuccino


1 Answers

You could use base32 (code easy to google), which is sort of a standard alternative to base64. Or resort to bin2hex() and pack("H*",$hex) to reverse. Hex encoding however leads to size doubling.

like image 110
mario Avatar answered Oct 29 '25 02:10

mario



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!