Array_pop () Definition and usage
The Array_pop () function deletes the last element in the array.
Grammar
Array_pop (Array) parameter description
Array required. Specifies the input array parameters.
Example
Copy the Code code as follows:
$a =
In_array () Definition and usage
The In_array () function finds whether the specified value exists in the array.
Grammar
In_array (value,array,type) parameter description
Value is required. Specifies the value to search for in the array.
Array
Introduced
For PHP performance problems, the most talked about is the __autoload () method, many people mention that this method has a significant impact on performance. Others say that opcode can also affect the __autoload () method, so I made a
Core code:
Copy the Code code as follows:
Header ("Expires:mon, Jul 1997 05:00:00 GMT");Header ("last-modified:". Gmdate ("D, D M Y h:i:s"). " GMT ");Header ("Cache-control:no-cache, must-revalidate");Header ("Pramga:no-cache");
This is useful
Definition and usage
The Str_pad () function fills a string with the specified length.
Grammar
Str_pad (string,length,pad_string,pad_type) parameter description
string is required. Specifies the string to populate.
Length required. Specifies the
Three ways to implement PHP timed execution
1. Scheduled Tasks for Windows
2, the Linux script program
3. Let the Web browser refresh periodically
Specific implementation
Windows Scheduled Tasks
PHP rarely run on the win server, the specific
1. If a method C++an be static, declare it static. Speed improvement are by a factor of 4. If a method is static, it is statically declared. The rate can be increased to 4 times times.
2. Echo is faster than print. echo is faster than print.
3. Use
1. Preg_replace ()
$msg = Preg_replace ("/
and the middle part
$msg = Preg_replace ("/]+>/", "", $msg); -----is to delete <> and intermediate content
I (pcre_caseless)
If this modifier is set, the characters in the pattern will match the uppercase
URL Jump Code
1. Code:
If saved as aaa.php, can realize aaa.php?url=www.baidu.com jump to Baidu effect.
This simple invocation of the default $_get variable. and PHP default jump location:
2. Instance upgrade: Increase if loop
Code:
Copy the
Copy CodeThe code is as follows:
!--? php
//Author: Distant Expectations
//qq:15624575
//Algorithm analysis: 1, must be an integer sequence, 2, if the entire sequence is not full of negative numbers, the first item of the maximum
Find the project folder below the Lib/action this directory, there is a good example to create IndexAction.class.php, join us to create the admin this project, then./admin/lib/action/ IndexAction.class.php, this module is the default loaded module.
/**
* Command mode
*
* Encapsulate a request as an object so that you can parameterize the customer with different requests, exclude or log request logs, and support actions that can be canceled
*/
Interface Command
{
Public function execute
Go directly to the code!
Copy the Code code as follows:
/** Insert sort (one-dimensional array)* Each time a data element to be sorted is inserted into the appropriate position in the previously sorted sequence, the sequence remains orderly until
This is the list of the 13 PHP coding good habits, if you have better suggestions, welcome to the comments later in this article, I am a person who likes to seek knowledge
1. When querying information from the same database using SELECT, use a join
Copy CodeThe code is as follows:
function List_tables ($database){$rs = Mysql_list_tables ($database);$tables = Array ();while ($row = Mysql_fetch_row ($rs)) {$tables [] = $row [0];}Mysql_free_result ($RS);return $tables;}
However, because the
Data that needs to be manipulated:
Copy the Code code as follows:
$test =array([0] = = StdClass Object([tags] = fastest car, BLOODHOUND,SSC[id] = 48326888))
The web-based approach is to use Get_object_vars to convert the class type to an array
For example, there are two memcached modules in Pecl, Memcache and memcached, most of the current PHP environment is using the Memcache version without d in the name, this version released earlier, is a native version, The corresponding memcached
Modify the time format:
Date ("Y-m-d", Strtotime ($list [' pubdate ']));
Learn to interpret: Put the time in strtotime for the time stamp and use date () to convert the format. The following two functions are written
PHP Strtotime () function
The
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