[PHP] Practical functions 10_php Tips

Source: Internet
Author: User
Tags float number mixed natural logarithm php script square root
Converts the character of an IP dot-point address back to an IP V4 format address

int Ip2long (string ip_address)
Converts the IP V4 format address back to the IP point-address string

String Long2ip (int proper_address)
Gets the environment variable varname, succeeds returns the variable value, the failure returns false by the return

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

void Putenv (String setting)
Get 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 ...])
Returns the port associated with the Service (protocol), must be TCP or UDP

int Getservbyname (String service,string protocol)
Returns the service name (protocol) associated with the port, which must be either TCP or UDP

String Getservbyport (int port,string protocol)
Take absolute value

Mixed ABS (mixed number)
Open square root

float sqrt (float arg)
The secondary value of natural logarithm E

FLOAT exp (float arg)
return pi

Double pi (void)
Rounded

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

int Ceil (float number)
Calculates the maximum integer less than the specified

int floor (float number)
Take the maximum value

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

Mixed min (mixed arg1,mixed arg2...mixed argn)
Take random numbers

int rand ([int min],[int Max])
Numbering conversion

String Base_convert (String number,int frombase,int tobase)
To format a string of numbers

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.