1 / 5

php – Math functions

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/>"; ?>. 四捨五入.

vonda
Download Presentation

php – Math functions

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. php – Math functions

  2. 常用數學函數

  3. 亂數 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/>"; ?>

  4. 四捨五入 <?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?>

  5. 二, 八, 十, 十六進位轉換

More Related