php random float number with 2 decimal places

Solutions on MaxInterview for php random float number with 2 decimal places by the best coders in the world

showing results for - "php random float number with 2 decimal places"
Maura
08 Sep 2019
1$decimals = 2; // number of decimal places
2$div = pow(10, $decimals);
3
4// Syntax: mt_rand(min, max);
5mt_rand(0.01 * $div, 0.05 * $div) / $div;