[PHP] practical functions 10

Source: Internet
Author: User
Tags float number natural logarithm

// Convert the characters of IP address points into IP address v4 format

Int ip2long (string ip_address)
// Convert the IP v4 format address back to the IP point address string

String long2ip (int proper_address)
// Obtain the environment variable varname. If it succeeds, the variable value is returned. If it fails, false is returned.

String getenv (string varname)
// Used to set the system environment

Void putenv (string setting)
// Obtain the owner name of the current PHP script

String get_current_user (void)
// Call the user function specified by function_name

String get_cfg_var (string function_name [, mixed parrameter [, mixed...])
// Return the port (protocol) associated with the service, which must be TCP or UDP

Int getservbyname (string service, string protocol)
// Return the name of the service associated with the port (protocol), which must be TCP or UDP

String getservbyport (int port, string protocol)
// Obtain the absolute value

Mixed abs (mixed number)
// Square root

Float sqrt (float arg)
// The power of natural logarithm e

Float exp (float arg)
// Returns the circumference rate.

Double pi (void)
// Rounding

Double round (double val)
// Calculate the smallest integer greater than the specified number

Int ceil (float number)
// Calculate the value smaller than the specified maximum integer.

Int floor (float number)
// Obtain the maximum value

Mixed max (mixed arg1, mixed arg2. .. mixed argn)
// Obtain the minimum value

Mixed min (mixed arg1, mixed arg2. .. mixed argn)
// Obtain the random number

Int rand ([int min], [int max])
// Numeric Conversion

String base_convert (string number, int frombase, int tobase)
// Format the numeric string

String number_format (float number, int [decimals], string [decpoint], string [thounsands_sep])

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.