"; echo rand(1,49)."
"; echo mt_rand(1,49)."
"; ?>. 四捨五入.">
Php math functions
This presentation is the property of its rightful owner.
Sponsored Links
1 / 5

php – Math functions PowerPoint PPT Presentation


  • 89 Views
  • Uploaded on
  • Presentation posted in: General

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

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


Php math functions

php – Math functions


Php math functions

常用數學函數


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/>";

?>


Php math functions

四捨五入

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


Php math functions

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


  • Login