亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP math commonly used functions

In PHP programs, data processing operations are often required, which requires the use of mathematical functions. Mathematical functions are the simplest and most commonly used system functions. This chapter takes mathematical functions as an example to explain how to call system functions.

Let’s talk about our most commonly used mathematical functions now. Before explaining mathematical functions, let's talk about one thing. That's it - PHP has a lot of counting functions, as shown in the following link screenshot:

document_2015-08-18_55d33e586844d.png

You don't need to master all of these. You will know that there are so many mathematical functions in PHP for you after reading them. That’s it. When needed in the future, just use it directly.

You only need to remember the most commonly used ones. I will give you a list of the most commonly used ones:

##mt_rand()More Good random numberecho mt_rand(0,9);//nMinimum/maximum, random numberRandomly returns a value within the rangerand()Random numberecho rand()Minimum/maximum, random numberRandomly returned within the range The valuepi()Get the pi valueecho pi(); // 3.1415926535898NoneGet piContinuing Learning
||
<?php $abs = abs(-4.2); //4.2 ?>
submitReset Code
      <abbr id="k6na8"></abbr>
      Function name DescriptionExampleInputOutput
      abs()Request Absolute value$abs = abs(-4.2); //4.2NumberAbsolute value number
      ceil( )Round to an integerecho ceil(9.999); // 10Floating point numberRound to an integer
      floor()Truncation and roundingecho floor(9.999); // 9Floating point number Directly discard the decimal part
      fmod()Floating point number remainder"$x = 5.7;$y = 1.3;$r = fmod($x, $y);// $r equals 0.5, because 4 * 1.3 + 0.5 = 5.7 "Two floating point numbers, x>yFloating point remainder
      pow()Returns the nth power of the numberecho pow(-1, 20); // 1Basic Number nth powerPower value
      round()Floating point number roundingecho round(1.95583, 2) ;// 1.96A numerical valueHow many digits to keep after the decimal point, the default is 0. The rounded result
      sqrt() Find the square rootecho sqrt(9); //3The number that is the square rootsquare root
      max()Find the maximum value"echo max(1, 3, 5, 6, 7); // 7 echo max(array(2, 4, 5)); / / 5"Multiple numbers or arraysReturn the maximum value
      min()Find the minimum valueminMultiple numbers or arraysReturn the minimum value
      <dfn id="k6na8"><fieldset id="k6na8"></fieldset></dfn>

        <meter id="k6na8"><span id="k6na8"></span></meter>
        <tfoot id="k6na8"></tfoot>