- 112 Views
- Uploaded on
- Presentation posted in: General

php – Math functions

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

php – Math functions

float lcg_value ()

產生介於0與1之浮點亂數

int mt_rand(min, max)

intrand(min, max)

產生介於min與max之整數亂數

<?php

echo lcg_value()."<br/>";

echo rand(1,49)."<br/>";

echo mt_rand(1,49)."<br/>";

?>

<?phpecho round(3.4); // 3echo round(3.5); // 4echo round(3.6); // 4echo round(3.6, 0); // 4echo round(3.6); // 4echo round(1.95583, 2); // 1.96echo round(1241757, -3); // 1242000echo round(5.045, 2); // 5.05echo round(5.055, 2); // 5.06?>