3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function crypto_rand_secure($min, $max) { $range = $max - $min; if ($range < 0) return $min; // not so random... $log = log($range, 2); $bytes = (int) ($log / 8) + 1; // length in bytes $bits = (int) $log + 1; // length in bits $filter = (int) (1 << $bits) - 1; // set all lower bits to 1 do { $rnd = hexdec(bin2hex(openssl_random_pseudo_bytes($bytes))); $rnd = $rnd & $filter; // discard irrelevant bits } while ($rnd >= $range); return $min + $rnd; } function getToken($length){ $token = ""; $codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $codeAlphabet.= "0123456789"; for($i=0;$i<$length;$i++){ $token .= $codeAlphabet[crypto_rand_secure(0,strlen($codeAlphabet))]; } return $token; } echo getToken(6);
Output for 7.1.25 - 7.3.1
Fatal error: Uncaught Error: Call to undefined function openssl_random_pseudo_bytes() in /in/0jufo:10 Stack trace: #0 /in/0jufo(21): crypto_rand_secure(0, 36) #1 /in/0jufo(26): getToken(6) #2 {main} thrown in /in/0jufo on line 10
Process exited with code 255.
Output for 7.1.7
3CAJYP
Output for 7.1.6
N1HSEM
Output for 7.1.5
ON7J9B
Output for 7.1.4
RL1JA1
Output for 7.1.3
HAPU79
Output for 7.1.2
ZAVLXA
Output for 7.1.1
HBY1Z7
Output for 7.1.0
WKH2PS
Output for 7.0.20
Z878FU
Output for 7.0.19
J9XY50
Output for 7.0.18
UYZ443
Output for 7.0.17
X3PDO4
Output for 7.0.16
7OO43I
Output for 7.0.15
9LZTKC
Output for 7.0.14
FPGBRT
Output for 7.0.13
4O6KJE
Output for 7.0.12
BKGZGS
Output for 7.0.11
ZAOLUF
Output for 7.0.10
3K5JZO
Output for 7.0.9
QP2TRD
Output for 7.0.8
HIGI54
Output for 7.0.7
L9DT7W
Output for 7.0.6
Y22UZK
Output for 7.0.5
V50YX1
Output for 7.0.4
AUMHBS
Output for 7.0.3
LPXWZE
Output for 7.0.2
L3IDPA
Output for 7.0.1
MDMXW3
Output for 7.0.0
5WCNNY
Output for hhvm-3.17.3
DB1JL6
Output for hhvm-3.15.4
7M7RNA
Output for hhvm-3.13.2
47S8GZ
Output for hhvm-3.12.14
H29Y4Q
Output for hhvm-3.11.1
GXUS39
Output for hhvm-3.10.1
YXIUR7
Output for 5.6.30
20LN9B
Output for 5.6.29
STPYP0
Output for 5.6.28
R1XWWE
Output for 5.6.27
VCX0PI
Output for 5.6.26
WVF08Z
Output for 5.6.25
KXU4HZ
Output for 5.6.24
5R2HJ3
Output for 5.6.23
LI2RFC
Output for 5.6.22
NEWZ64
Output for 5.6.21
4QXTRH
Output for 5.6.20
LE9JQ9
Output for 5.6.19
BTMBT3
Output for 5.6.18
8EPGWE
Output for 5.6.17
V5JX87
Output for 5.6.16
H6G70X
Output for 5.6.15
Y7OXX5
Output for 5.6.14
UWA2CH
Output for 5.6.13
FZ1CVR
Output for 5.6.12
VSHT2D
Output for 5.6.11
5T61KE
Output for 5.6.10
PUM6RC
Output for 5.6.9
NEMD9X
Output for 5.6.8
J5VZV0
Output for 5.6.7
AU5NYH
Output for 5.6.6
4UEMMO
Output for 5.6.5
J7H078
Output for 5.6.4
H8LRPD
Output for 5.6.3
3P5V1H
Output for 5.6.2
DIJT7L
Output for 5.6.1
BQOZUS
Output for 5.6.0
IKKMIJ
Output for 5.5.38
QIOGE1
Output for 5.5.37
URMR9F
Output for 5.5.36
694DNC
Output for 5.5.35
7MU2CT
Output for 5.5.34
8G3IZG
Output for 5.5.33
ADKIDN
Output for 5.5.32
JSKXIP
Output for 5.5.31
1YINJ3
Output for 5.5.30
NS60K8
Output for 5.5.29
H8P82D
Output for 5.5.28
1PV4PP
Output for 5.5.27
4VVJEU
Output for 5.5.26
RJW974
Output for 5.5.25
LBV04C
Output for 5.5.24
J15GXJ
Output for 5.5.23
KLRCZU
Output for 5.5.22
BHOAN8
Output for 5.5.21
6EAZD7
Output for 5.5.20
FUEEJ3
Output for 5.5.19
L8R8LU
Output for 5.5.18
VRPZ6G
Output for 5.5.16
QYFX4F
Output for 5.5.15
TUHA45
Output for 5.5.14
ZJ7970
Output for 5.5.13
J3SMQT
Output for 5.5.12
1A0HF0
Output for 5.5.11
B1G1NG
Output for 5.5.10
7Q5I23
Output for 5.5.9
X1O8PU
Output for 5.5.8
09VA7U
Output for 5.5.7
WMIVQK
Output for 5.5.6
8AVRRF
Output for 5.5.5
8372S9
Output for 5.5.4
O8BRZ4
Output for 5.5.3
M4VH21
Output for 5.5.2
DUMDH0
Output for 5.5.1
A6I6O2
Output for 5.5.0
W5OFF3
Output for 5.4.45
Z18W8Z
Output for 5.4.44
28JSJV
Output for 5.4.43
PDLES7
Output for 5.4.42
F0HEFR
Output for 5.4.41
7VZRJK
Output for 5.4.40
ZAABBQ
Output for 5.4.39
JRJNFP
Output for 5.4.38
MTA875
Output for 5.4.37
JHEBK8
Output for 5.4.36
75F58R
Output for 5.4.35
KA21LF
Output for 5.4.34
9R4555
Output for 5.4.32
TJQQZV
Output for 5.4.31
1GNZLQ
Output for 5.4.30
S6OJJI
Output for 5.4.29
PD0STI
Output for 5.4.28
ZOEJM0
Output for 5.4.27
50XZJX
Output for 5.4.26
SWXHCT
Output for 5.4.25
00G3CY
Output for 5.4.24
LJAV3W
Output for 5.4.23
MU6N9Q
Output for 5.4.22
IUBZTM
Output for 5.4.21
JZ15FV
Output for 5.4.20
DOXM98
Output for 5.4.19
LKACN0
Output for 5.4.18
SK4C30
Output for 5.4.17
I616UM
Output for 5.4.16
5ZSHUO
Output for 5.4.15
LINC51
Output for 5.0.0 - 5.4.14
Fatal error: Call to undefined function openssl_random_pseudo_bytes() in /in/0jufo on line 10
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: openssl_random_pseudo_bytes() in /in/0jufo on line 10
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: openssl_random_pseudo_bytes() in /in/0jufo on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: openssl_random_pseudo_bytes() in /in/0jufo on line 10