1. Sys_getloadavg ()
SYS_GETLOADAVT () can obtain the system load condition. The function returns an array of three elements, each representing the average load of the system in the past 1, 5, and 15 minutes, respectively. Rather than letting the
The PHP built-in function memory_get_usage () returns the amount of memory currently allocated to the PHP script in bytes (byte). In the actual development of the web, these functions are very useful, and we can use it to debug PHP code
The length of a string in a PHP program can be judged by using strlen.
Method One:
$str = ' aaaaaa ';
if (strlen ($STR) > 6) {
echo "string greater than 6";
}
Method Two:
if (Isset ($str {6}) {
}
These two methods, the second
There is no doubt that the design pattern is much more than others in the system. Design patterns make coding truly engineering; Design patterns are the bedrock of software engineering, like the structure of a building.Single case mode
Singleton
The goal of PHP optimization is to get the fastest running speed and the easiest code to maintain with the least cost. To provide you with the following optimization techniques:
1. Echo is faster than print.
2. Use Echo's multiple parameters
In web development, we often use PHP similar text to compute two string similarity;
The use of 1,similar_text
If I want to calculate the similarity between "LY89CN" and "ly89", there are two ways to represent it.
Copy Code code as follows:
This feature was presented at php5.0x Time and was subsequently canceled and arranged for implementation in PHP6. This time again "advance" to the PHP5.3 release, can be seen by developers of its attention and cautious attitude.
The content of the
Use the Json_encode () built-in function (Php > 5.2) in PHP to use the data in PHP to communicate well with other languages and use it.
The function of this function is to convert a numeric value into a JSON data storage format.
' Shia ',
PHP's unique syntax mixes C, Java, Perl, and PHP with its own innovative syntax. It can execute dynamic Web pages faster than CGI or Perl. Dynamic pages made with PHP compared to other programming languages, PHP embeds programs into HTML documents
1, get all the pictures in the Web page:
Copy Code code as follows:
Gets the contents of the address and stores it in the $text
$text =file_get_contents (' http://www.jb51.net/');
Gets all the IMG tags and stores them in a
PHP uses the GD library to generate thumbnails.
Copy Code code as follows:
Header ("CONTENT-TYPE:TEXT/HTML;CHARSET=GBK");
Ini_set ("Date.timezone", "Asia/chong");
Determine if the file is empty
if (empty ($_files)) {
echo
With two days of PHP Snoopy this class, found very useful. Get all the links inside the request page, use Fetchlinks directly, get all the text information using the Fetchtext (inside or using regular expressions for processing), there are many
Copy Code code as follows:
XML string
$xml _string= "
Foo
foo@bar.com
Foobar
foobar@foo.com
";
Load the XML string using SimpleXML
$xml = simplexml_load_string ($xml _string);
Loop through the each
Recently, when developing a PHP program, I encountered the following problem:
PHP Fatal error:allowed Memory size of 268 435 456 bytes Exhausted
The error message shows that the maximum allowable memory has been exhausted. I was surprised at first
Especially like to know which spiders to the site to visit, the frequency of visits, pages, ordinary site statistics are unable to solve.
Although I know very little about PHP, but by virtue of. NET development experience, with the help of Baidu
In PHP, arrays are grouped into two categories: Numeric index arrays and associative arrays.
Where the numeric index array is the same as the array in C language, subscript is for 0,1,2 ...
An associative array subscript may be any type, similar to
No more nonsense to say, directly with everyone to paste the code
dropbox_index.php
main search engine dropdown box automatically displays data
dropbox.js Ajax
var xmlHttp function Showhint (
The return content disappears after the form submits an error how to do, today to analyze and solve this problem.
Status Overview:
When you fill out a form information submission, you will encounter a problem is when the user fills out and submits
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