gerador de números aleatórios em php
you can use rand() function for that in php.
Example:
Generate random numbers between 1 to 50
<?php
echo rand(1,50);
?>
Ankur
you can use rand() function for that in php.
Example:
Generate random numbers between 1 to 50
<?php
echo rand(1,50);
?>
<?php
$sixDigitRandomNumber = mt_rand(111111,999999);
echo $sixDigitRandomNumber;
?>
<?php
#The rand() function generates a random number:
echo(rand());
#Picks a random number from anywhere to anywhere
echo(rand(0, 10));
#Picks a random number from 0 to 10
<?
rand(0,10);
or
random_int(0,10)
// $min and $max are optional
rand($min,$max);
<?php
// src/Controller/LuckyController.php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Response;
class LuckyController
{
public function number(): Response
{
$number = random_int(0, 100);
return new Response(
'<html><body>Lucky number: '.$number.'</body></html>'
);
}
}