Skip to content

Instantly share code, notes, and snippets.

@dryliketoast
Created January 12, 2016 15:15
Show Gist options
  • Save dryliketoast/5c51d48da1b0d5662476 to your computer and use it in GitHub Desktop.
Save dryliketoast/5c51d48da1b0d5662476 to your computer and use it in GitHub Desktop.
Base 36 to Integer:
intval($str,36)
Integer to Base 36:
base_convert($val, 10, 36)
So then, instead of redirecting to a route like /url/1234 it becomes /url/ax instead.
This gives you a whole lot more use than a hash will, as there will be no collisions.
Don't hash, use other bases for this kind of thing. (It's faster and can be made collision-proof.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment