Təsadüfi mətn

Verilmiş ölçüdə yalnız hərflərdən təsadüfi mətn yaratmaq
Anonymous
php
11/11/2021 6:35 AM
624 B
21
Indexable
<?php


function anotherRandomIDGenerator()
{
    // burada yazilan olcu + 1 yalniz herflerden ibaret metn generasiya edir
    $len = 8;
    $base = 'ABCDEFGHKLMNOPQRSTWXYZabcdefghjkmnpqrstwxyz';
    $max = strlen($base) - 1;
    $activatecode = '';
    mt_srand((double)microtime() * 1000000);
    while (strlen($activatecode) < $len + 1)
        $activatecode .= $base{mt_rand(0, $max)};
    return $activatecode;
}

echo anotherRandomIDGenerator();
Editor is loading...