Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Generate a secure token.
*
* @url http://stackoverflow.com/questions/18910814/best-practice-to-generate-random-token-for-forgot-password
*/
function generateToken($length = 40)
{
return bin2hex(random_bytes($length));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment