mardi 10 mai 2016

Modify this PHP script please: generate random string + text + multiple lines

I finally joined this huge community... I have been a long time lurker... and I actually got this script from here... but it is not quite what I needed... that is why I am seeking help...

This is the code:

<?php
function generateRandomString($length = 10) {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}

// Echo the random string.
// Optionally, you can give it a desired string length.
<?php echo generateRandomString(); ?>
?>

basically, I wanted this small php script to generate thousands of lines (~3000)...

in this format:

mytext/(the_random_string_here)
mytext/(the_random_string_here)
mytext/(the_random_string_here)
mytext/(the_random_string_here)
mytext/(the_random_string_here)

up to the very end (~3000 lines)


with each line have a random string...

Thank you so much guys!




Aucun commentaire:

Enregistrer un commentaire