Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

assign random to a variable in PHP

<?php
function random_str_generator ($len_of_gen_str){
    $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    $var_size = strlen($chars);
    echo "Random string ="; 
    for( $x = 0; $x < $len_of_gen_str; $x++ ) {  
        $random_str= $chars[ rand( 0, $var_size - 1 ) ];  
        echo $random_str;  
    }
echo "
";
}
random_str_generator (8)
?>
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #assign #random #variable #PHP
ADD COMMENT
Topic
Name
9+2 =