generating random token php

Solutions on MaxInterview for generating random token php by the best coders in the world

showing results for - "generating random token php"
Bryan
28 Mar 2018
1<?php
2 
3//Generate a random string.
4$token = openssl_random_pseudo_bytes(16);
5 
6//Convert the binary data into hexadecimal representation.
7$token = bin2hex($token);
8 
9//Print it out for example purposes.
10echo $token;
11?>