php - How to convert range of generated alphanumeric code into an array -


 below code have written <?php  $pincode="" ; function getpincode($length){  $pincode = "";  $codealphabet="abcdefghijklmnopqrstuvwxyz";  $codealphabet.= "0123456789";   $max = strlen($codealphabet); // edited  ($i=0; $i < $length; $i++) {     $pincode.= $codealphabet[random_int(0, $max-1)];//to output combined code  implode('', $pincode)// convert code array  $pincode= array()//explicitly declare $pincode var  } ​return $pincode;  }  ($n=0;$n<8; $n++){ echo getpincode(11); echo ", "; print_r($pincode); }?> 

//if run above gives errors 1. array string conversion 2. implode() invalid argument passed. if comment on 2 lines errors /originate generates 8 different codes not array.

i want generate set of codes /using php , make them array. please did go wrong. million ​

you assign $pincode array random values

for ($i=0; $i < $length; $i++) {    $pincode[$i]= $codealphabet[random_int(0, $max-1)];//array of code  } 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -