i want to loop a variable and assign this variable in database i use this code
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen( $chars );
for( $i = 0; $i < 10; $i++ ) {
$str = $chars[ rand( 0, $size - 1 ) ];
}
if i use $str outside the for loop it will give me just 1 random character if i use it indside for loop it will give me random 10 character
how can i use this code to generate the random 10 characters ??
i tried to define the variable before loop string like this
$str = '';
but also not working for me..