Basic knowledge:Variable names must be $ identified by symbolsNaming conventions for variables:1. Variable names must begin with a letter or underscore "_", such as "$_name", "$name", "$name 2", etc., but "$9name" is not correct.2, the variable name
The array processing function described in this section can complete more complex array processing tasks and process arrays as a set. For example, you can merge multiple arrays of two goods, calculate the difference set or intersection between
This article mainly introduces php's method for removing duplicate items from two-dimensional arrays. For more information, see
This article mainly introduces php's method for removing duplicate items from two-dimensional arrays. For more
Determine whether the php array is an indexed array. HP does not have a built-in method to determine whether to index an array. it implements a simple method: Copy the code as follows: echois_assoc ($ array )? Index array: it is not an index array.
Summary of optimizing PHP code skills. Summary of optimizing PHP code skills 1. if a method can be static, it is declared as static, and the speed can be improved by 14; 2. echo is more efficient than print, because echo does not return values,
1. Merging Arrays
The Array_merge () function merges the arrays together to return an array of unions. The resulting array starts with the first input array parameter, forcing it sequentially in the order in which the array parameters appear later.
Memcache functions in PHP
Memcache functions are listed as follows:
Memcache: add? Add a value. if it already exists, false is returned.
Memcache: addServer? Add an available server address
Memcache: close? Disables a Memcache object.
For Web programming, the most important thing is to access and read and write data. There may be many ways to store them, such as strings, arrays, files, and so on. arrays, which can be said to be a more important way of data application in PHP. PHP
The most commonly used data structure in PHP is arrays, which can help us solve a large part of the programming problem. In fact, there are a lot of array operations without our own writing, the system has come with the relevant functions. Let's
PHP 2D arrays are sorted by a certain key value
Function array_sort ($ array, $ keys, $ type = 'asc '){
If (! Isset ($ array) |! Is_array ($ array) | empty ($ array )){
Return ";
}
If (! Isset ($ keys) | trim ($ keys) = "){
Return ";
}
If (!
The difference in php array traversal (array_diff) was first introduced to this topic. I found it very simple, so I wrote one according to my previous experience:
Function array_diff ($ array_1, $ array_2 ){
$ Diff = array ();
Foreach ($ array_1 as
First, what is an array
An array is a set of data that organizes a series of data to form an operational whole. Each entity of an array contains two items: A key and a value.
II. Statement of data
There are two main ways to declare an array in
During programming, I often forget the usage of some Arrays. I only remember that there is such a function. I don't know how to use it. now I use it as a manual.
During programming, I often forget the usage of some Arrays. I only remember that there
About PHP array Operations $ temp = array ('k1 '=> array ('M1' => '1', 'M2 '=> '2 '), 'K2' => array ('M1 '=> '3', 'M2' => '4 '));
As shown in the above structure array, how can we make a reasonable operation?
1. delete the element whose key value is
Php array (2) add elements to the array header
Array_unshift ($ states, 'AAA'); add aaa to the header of the array $ states, that is, the first
Add elements at the end of the array
Array_push ($ states, 'AAA'); add aaa to the end of the array $
Let's share some good things.
1. if a method can be static, it is declared as static, and the speed can be increased by 1/4; 2. ECHO is more efficient than print. Because ECHO does not return a value, print returns an integer. 3. set the maximum
Currently, memcache is widely used in server cache. Here is an example of implementing message queue waiting in memcache. For more information, see.
The principle of memche message queue is to make an article on the key to record messages or logs
1. boolean sort (array target_array [, int sort_flags]): sort by number and letter
2. boolean rsort (array target_array [, int sort_flags]): sorts array elements in descending order.
3. Void asort (array target_array [, int sort_flags]): sorts
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.