0
I want to format a value that leaves the function rand()
only it’s not the usual way. I have a rand()
:
<?php
$valor = rand(3000,7000);
echo number_format($valor, 2);
?>
Output: 5000,00
I need the output to be 50,00 and not 5000,00.
It had a code that the rand()
would go with the "." (dot) being more or less like this
<?php
rand(30.00, 70.00)
?>
Only that it seemed that he made the draw with the first 2 values, from 30 to 70 and also need to take the cents, IE, It can be a draw that came out for example 41.32
you always want whole, that’s it?
– Marllon Nasser
@Marllonnasser no, I need some of the values after "." (point). That is, it can be 30.00 as well as 32.59 for example.
– Alisson Acioli
then what is the doubt? rs
– Marllon Nasser
I need the function
rand()
draw these kind of numbers. Not only integers, but completes. I have the minimum value 30.00 and the maximum 70.00 so Rand() has to draw values in this range and I want to return tb the cents.– Alisson Acioli