Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php random float number with 2 decimal places

$decimals = 2; // number of decimal places
$div = pow(10, $decimals);

// Syntax: mt_rand(min, max);
mt_rand(0.01 * $div, 0.05 * $div) / $div;
Comment

PREVIOUS NEXT
Code Example
Php :: Extract images from a folder in php 
Php :: link js file in php 
Php :: wp_query limit 1 
Php :: wordpress post excerpt from post id 
Php :: php8.1 extensions 
Php :: php get number from string 
Php :: extract all arrays from sql response in php 
Php :: Algeria 
Php :: CGST/SGST calculate in laravel 8 
Php :: How to get the current date in PHP? 
Php :: create custom domain in localhost xampp 
Php :: laravel form method delete 
Php :: get logged user id laravel 
Php :: how get just one parameter of all objects in one array in laravel 
Php :: laravel check php version 
Php :: how to check number only in php 
Php :: check if $_files is empty php 
Php :: wordpress disable posts 
Php :: string to int laravel 
Php :: wp do sql query from function 
Php :: twig create new array 
Php :: php client enable short tags 
Php :: get_boundary_post wordpress 
Php :: deleteAll cakephp 2 
Php :: php foreach associative array 
Php :: laravel model db raw count 
Php :: ci count 
Php :: php check if get var is set 
Php :: validate time in laravel 
Php :: convert comma separated number to number in php 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =