3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $length = 12; $token = bin2hex(random_bytes($length)); echo $token;
based on AsBkM
Output for 7.2.0
7e383e13b566b30377d6cb11
Output for 7.1.10
35f37083c11ea0696d2f50bd
Output for 7.1.7
982dc2b3a82c5462c115b5f4
Output for 7.1.6
1655b3c847b7ac9e4ff97fad
Output for 7.1.5
eef1d08296227ae62ca02b4a
Output for 7.1.0
7b180b15c1fedea5585d40bb
Output for 7.0.20
d6dae88bf950f876d03fffc3
Output for 7.0.6
877af047a8be6ed1355ce26d
Output for 7.0.5
4f76a40670b4fe0979c829fb
Output for 7.0.4
0aae3d73336e7c782a636de6
Output for 7.0.3
20716588dae170056833b0db
Output for 7.0.2
6a76eaa8f7fef999b15c4fd5
Output for 7.0.1
59d49d11d85e82328d580d71
Output for 7.0.0
8d966995312c18f93a68221e
Output for 5.3.22 - 5.6.28
Fatal error: Call to undefined function random_bytes() in /in/Zd1Pq on line 4
Process exited with code 255.