php - PowerPoint PPT Presentation

About This Presentation
Title:

php

Description:

php Math functions Function Description abs() Returns the absolute value of a number ceil() Returns the value of a number rounded upwards to the nearest integer ... – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 6
Provided by: pyx80
Category:
Tags: functions | php

less

Transcript and Presenter's Notes

Title: php


1
php Math functions
2
??????
Function Description
abs() Returns the absolute value of a number
ceil() Returns the value of a number rounded upwards to the nearest integer
floor() Returns the value of a number rounded downwards to the nearest integer
is_nan() Returns true if a value is not a number
lcg_value() Returns a pseudo random number in the range of (0,1)
max() Returns the number with the highest value of two specified numbers
min() Returns the number with the lowest value of two specified numbers
pow() Returns the value of x to the power of y
mt_rand() Returns a random integer using Mersenne Twister algorithm
rand() Returns a random integer
round() Rounds a number to the nearest integer
sqrt() Returns the square root of a number
3
??
  • float lcg_value ()
  • ????0?1?????
  • int mt_rand(min, max)
  • int rand(min, max)
  • ????min?max?????

lt?php echo lcg_value()."ltbr/gt" echo
rand(1,49)."ltbr/gt" echo mt_rand(1,49)."ltbr/gt"
?gt
4
????
  • lt?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?gt

5
?, ?, ?, ??????
base_convert() Converts a number from one base to another
bindec() Converts a binary number to a decimal number
decbin() Converts a decimal number to a binary number
dechex() Converts a decimal number to a hexadecimal number
decoct() Converts a decimal number to an octal number
hexdec() Converts a hexadecimal number to a decimal number
octdec() Converts an octal number to a decimal number
Write a Comment
User Comments (0)
About PowerShow.com