3v4l.org

run code in 300+ PHP versions simultaneously
<?php $chars = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"; $chars2 = "0,1,2,3,4,5,6,7,8,9"; $chars = str_replace("," , "" , $chars); $chars2 = str_replace("," , "" , $chars2); $result = []; for($i = 0 ; $i < 6 ; $i++) { $result[] = $i < 3 ? substr($chars , rand(0 , strlen($chars) - 1) , 1) : substr($chars2 , rand(0 , strlen($chars2) - 1) , 1); } shuffle($result); var_dump($result);

preferences:
34.24 ms | 402 KiB | 5 Q