3v4l.org

run code in 300+ PHP versions simultaneously
<?php $randomlettersnumbers = str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'); //creates a shuffled alphanumeric string $randomlettersnumbers2 = str_shuffle('0123456789!@#$%^&*()_+{}:|\<>?'); //creates a shuffled alphanumeric string $randcomb = $randomlettersnumbers.$randomlettersnumbers2; for($i = 0; $i <= 62; $i += 6) { //loop to calculate parameters for substr $param1 = ($i+6) - 6; //this formula ensures all integers are positive and above zero $param2 = $param1 + 6; // this formula ensures all integers increment by 6 spaces if($param2 >= 60) { //since the second parameter goes over 60 $param2 = ($param1 + 6) - 6; //subtract 6 } $key = substr($randcomb, $param1, $param2); //generate random key echo $key."<BR>"; //display it for debugging }

preferences:
25.38 ms | 402 KiB | 5 Q