3v4l.org

run code in 300+ PHP versions simultaneously
<?php function apikey( $length ) { $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; $size = strlen( $chars ); for( $i = 0; $i < $length; $i++ ) { $str= $chars[ rand( 0, $size - 1 ) ]; echo $str; } } $apikey = apikey(32); echo $apikey;

preferences:
23.3 ms | 404 KiB | 5 Q