Common php functions-common mathematical php string functions common php class libraries common php English letters

Source: Internet
Author: User
Php, commonly used: php common functions-Mathematics: some common functions that are compiled during php learning. this is a mathematical function .; 12 into an integer method echoceil (7.9999 ).; 8 rounding out the integer method echofloor (7.9999 ).; 7. some common functions are sorted out during the learning of php using floating point numbers. this is a mathematical function.

Header ("Content-Type: text/html; charset = UTF-8 ");
// Obtain the absolute value abs ();
Echo abs (-12 )."
"; // 12
// Returns an integer.
Echo ceil (1, 7.9999 )."
"; // 8
// Remove the integer
Echo floor (7.9999 )."
"; // 7
// Retrieve the remainder of a floating point number
$ X = 5.7;
$ Y = 1.3;
Echo fmod ($ x, $ y )."
"; // 0.5 1.3 0.5*4 + 5.7 =
/*
* $ X = 3.6;
* $ Y = 0.6;
* Echo $ r = fmod ($ x, $ y );
* If there is no remainder, unexpected results may occur.
*/
// Returns the n power of the number.
Echo pow (5, 3 )."
"; // The third time of 125 5 is 125
// Rounding floating point numbers
Echo round (1.95583, 2 )."
"; // 1.96
// Calculate the square root
Echo sqrt (64 )."
"; // 8
// Calculate the maximum and minimum values (the parameter cannot be a variable)
Echo max (1, 3, 5, 7, 9 )."
"; // 9
Echo min (5, 7, 9 )."
"; // 5
Echo max (array (1, 3, 5, 7, 9 ))."
"; // 9
Echo min (array (3,5, 7,9 ))."
"; // 3
// Random number
Echo mt_rand (0, 4 )."
"; // Random
Echo rand (5, 9 )."
"; // Random
// Obtain the circumference rate
Echo pi (); // 3.1415926535898

The above describes common php functions-mathematics, including php and common content. I hope my friends who are interested in PHP tutorials will be helpful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.