Php math functions
Download
1 / 5

php – Math functions - PowerPoint PPT Presentation


  • 117 Views
  • Uploaded on

php – Math functions. 常用數學函數. 亂數. float lcg_value () 產生介於 0 與 1 之浮點亂數 int mt_rand( min , max ) int rand( min , max ) 產生介於 min 與 max 之整數亂數. <?php echo lcg_value()."<br/>"; echo rand(1,49)."<br/>"; echo mt_rand(1,49)."<br/>"; ?>. 四捨五入.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' php – Math functions' - vonda


An Image/Link below is provided (as is) to download presentation

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 - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript


亂數

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?>


, 八, 十, 十六進位轉換


ad