generator de numere aleatoare în php
you can use rand() function for that in php.
Example:
Generate random numbers between 1 to 50
<?php
echo rand(1,50);
?>
php număr aleatoriu
// $min and $max are optional
rand($min,$max);
șir aleatoriu php
function rand_str() {
$characters = '0123456789-=+{}[]:;@#~.?/>,<|\!"£$%^&*()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomstr = '';
for ($i = 0; $i < random_int(50, 100); $i++) {
$randomstr .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomstr;
}
generator de numere aleatoare php
<?php
echo rand(1,50);
?>
php rand int
random_int ( int $min , int $max );
php număr întreg aleator
echo random_int(0,50);
php număr aleatoriu
rand(0,10);
or
random_int(0,10)
S. R. L. S. R. L
function random_part() {
return str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT);
}
function randomHEX($amount) {
$_result = "";
for ($i = 0 ; $i < $amount; $i++) {
$_result .= random_part();
}
return $_result;
}
//to get a 16 HEX number
echo randomHEX(8);
rendstring php
<?php
$random = substr(md5(mt_rand()), 0, 7);
echo $random;
?>