3v4l.org

run code in 300+ PHP versions simultaneously
<?php function apikey( $length ) { $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; $size = strlen( $chars ); $key =""; for( $i = 0; $i < $length; $i++ ) { $str= $chars[ rand( 0, $size - 1 ) ]; echo $str; $key .= $str; } return $key; } $apikey = apikey(32); echo "\noutside function\n"; echo $apikey;
Output for 7.3.8
ikEfHertnqpKAiXNaSxXzsEPClecruhl outside function ikEfHertnqpKAiXNaSxXzsEPClecruhl
Output for 7.3.7
Glg7YZ6RV2ycz6bCfWady0MUkmTxKeM4 outside function Glg7YZ6RV2ycz6bCfWady0MUkmTxKeM4
Output for 7.3.6
LYVTwr1M7veCcuJ5bucbHaroaGPOIaZ9 outside function LYVTwr1M7veCcuJ5bucbHaroaGPOIaZ9
Output for 7.3.5
YbUw6FkvoVNeexOTPM2xoOW652bc1U1d outside function YbUw6FkvoVNeexOTPM2xoOW652bc1U1d
Output for 7.3.4
c9lngIkYTuyv3dirkgpqTLT5UXuAiCo8 outside function c9lngIkYTuyv3dirkgpqTLT5UXuAiCo8
Output for 7.3.3
ypIpxwOiQsekOMumiGDDysXgT15K5s4z outside function ypIpxwOiQsekOMumiGDDysXgT15K5s4z
Output for 7.3.2
ZY18Pc487BD7EDwzGws92zg9yD9ZmcyT outside function ZY18Pc487BD7EDwzGws92zg9yD9ZmcyT
Output for 7.3.1
loB6CMi7Ig0MvdCEPxwSIEZbLMS6oZvU outside function loB6CMi7Ig0MvdCEPxwSIEZbLMS6oZvU
Output for 7.3.0
Xp9eVEK9b3XczBCpozS2cAX5QPbGhgNV outside function Xp9eVEK9b3XczBCpozS2cAX5QPbGhgNV
Output for 7.2.21
lV4aqmVBGzPguM3g4dEMCc4AsOQRC1gd outside function lV4aqmVBGzPguM3g4dEMCc4AsOQRC1gd
Output for 7.2.20
wPQR7mfSEQaja7ex9NZijkDRQxQTOFF1 outside function wPQR7mfSEQaja7ex9NZijkDRQxQTOFF1
Output for 7.2.19
o7r0YxX0ArhlBcTo49eBJt2IUZZthgAI outside function o7r0YxX0ArhlBcTo49eBJt2IUZZthgAI
Output for 7.2.18
8HPorqV7cSOY0gitf3n1tvRo1sviz9Vc outside function 8HPorqV7cSOY0gitf3n1tvRo1sviz9Vc
Output for 7.2.17
CsWNbyKbU7ux79dlmKKtwpFMLU3SxwpP outside function CsWNbyKbU7ux79dlmKKtwpFMLU3SxwpP
Output for 7.2.16
V0LXgirsza6eSc5lZVydQj2OnsKVB9KM outside function V0LXgirsza6eSc5lZVydQj2OnsKVB9KM
Output for 7.2.15
l957zgoguQCcb64jejYqbe1DF58xk6vs outside function l957zgoguQCcb64jejYqbe1DF58xk6vs
Output for 7.2.14
INAKcU1OP8i1lyDOy3WVj1sKS7bsQjXk outside function INAKcU1OP8i1lyDOy3WVj1sKS7bsQjXk
Output for 7.2.13
wU3HCDvxy7SUuOWmbIHdCe2gxgAWWAh4 outside function wU3HCDvxy7SUuOWmbIHdCe2gxgAWWAh4
Output for 7.2.12
IQhKObMznACVId3Y0hrXBAevzEfmPwb3 outside function IQhKObMznACVId3Y0hrXBAevzEfmPwb3
Output for 7.2.11
awIsXIXeUn3a1iBwtaEotZpe2gA7OrQG outside function awIsXIXeUn3a1iBwtaEotZpe2gA7OrQG
Output for 7.2.10
0IDNRBFSUCdm5wTqSNJfaOCP5Zqw0ZME outside function 0IDNRBFSUCdm5wTqSNJfaOCP5Zqw0ZME
Output for 7.2.9
fpZ0Up5MIwzsBeMcKdtDa3gyWn4cZFTH outside function fpZ0Up5MIwzsBeMcKdtDa3gyWn4cZFTH
Output for 7.2.8
7VC21CAob8ivJOnKGm64MplurQbGwqnl outside function 7VC21CAob8ivJOnKGm64MplurQbGwqnl
Output for 7.2.7
WndYYvfmyCmuAy1BHIAIiSRQ6xhgsiGX outside function WndYYvfmyCmuAy1BHIAIiSRQ6xhgsiGX
Output for 7.2.6
gs6V0FpcNt1pUJawnfFARAuQ1g2lpDVo outside function gs6V0FpcNt1pUJawnfFARAuQ1g2lpDVo
Output for 7.2.5
cYsBiWbv0v53hyHCi6i83SyEdyUwinP5 outside function cYsBiWbv0v53hyHCi6i83SyEdyUwinP5
Output for 7.2.4
ACg0rcAkOSMlLjzjVsBqDrCMUllPBlFy outside function ACg0rcAkOSMlLjzjVsBqDrCMUllPBlFy
Output for 7.2.3
1Ok3JvOgp1t5MdgOHIYhSk87vLL0md2M outside function 1Ok3JvOgp1t5MdgOHIYhSk87vLL0md2M
Output for 7.2.2
EvM7L7EMQ1Y9t9ZpDWdoDmvTjg7XiMOc outside function EvM7L7EMQ1Y9t9ZpDWdoDmvTjg7XiMOc
Output for 7.2.1
WdFxihtyjXl1DyNBC2xJ7TO0oCwpH2CY outside function WdFxihtyjXl1DyNBC2xJ7TO0oCwpH2CY
Output for 7.2.0
MOhjN7JctK6JcvuThAacpFpUOtmW3tkz outside function MOhjN7JctK6JcvuThAacpFpUOtmW3tkz
Output for 7.1.31
aJd3sD7xv5x5QPeyGH1gYVwehTm7tNvD outside function aJd3sD7xv5x5QPeyGH1gYVwehTm7tNvD
Output for 7.1.30
BNm0Y91XhxCJ5050wjlXMnmcZTbeQQzH outside function BNm0Y91XhxCJ5050wjlXMnmcZTbeQQzH
Output for 7.1.29
YUzPn282VEXjnGXjI4JCzPg3XXmujIg3 outside function YUzPn282VEXjnGXjI4JCzPg3XXmujIg3
Output for 7.1.28
L3TsSfZvAfAQjkw8gtbukccM0zIZO1s6 outside function L3TsSfZvAfAQjkw8gtbukccM0zIZO1s6
Output for 7.1.27
EheCrzVxraQpyV2FTdqUNWPcJFkTjYmG outside function EheCrzVxraQpyV2FTdqUNWPcJFkTjYmG
Output for 7.1.26
iXzBjHmtOAIQSwKssEHZXRHELD9MB2p5 outside function iXzBjHmtOAIQSwKssEHZXRHELD9MB2p5
Output for 7.1.25
nYHnTuyeeWKf6tKqr2s3GgUaS8VwBwrP outside function nYHnTuyeeWKf6tKqr2s3GgUaS8VwBwrP

preferences:
42.92 ms | 458 KiB | 5 Q