PHP: 10 uncommon but useful PHP functions

Source: Internet
Author: User
You can obtain the system load. This function returns an array containing three elements, each representing the average load of the system in the past 1, 5, and 15 minutes. 1. sys_getloadavg ()

Sys_getloadavt () can obtain the system load. This function returns an array containing three elements, each representing the average load of the system in the past 1, 5, and 15 minutes.

Instead of letting the server go down due to excessive load, it is better to take the initiative to die a script when the system load is very high. sys_getloadavg () is used to help you implement this function. But unfortunately, this function is invalid in windows.

2. pack ()

Pack () can convert a 32-bit hexadecimal string returned by md5 () to a 16-bit binary string, saving storage space.

3. cal_days_in_month ()

Cal_days_in_month () returns the total number of days in a specified month.

4 ._()

WordPress developers often see this function as well as _ e (). These two functions have the same functions and can be used in combination with the gettext () function to implement multilingual website operations. For more information, see the relevant section of the PHP Manual.

5. get_browser ()

Before sending the page, check what your browser can do? Get_browser () can obtain the browser type and functions supported by the browser. However, you need a php_browscap.ini file to provide a reference file for the function.

Note that this function is based on the general features of the browser. For example, if the user closes the browser's support for JavaScript, the function cannot know this. However, this function is very accurate in determining the browser type and OS platform.

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.