Php basic knowledge Summary (1) array, basic knowledge array
I. Sorting1. asort-Positive Sorting to maintain the index relationship2. arsort-reverse sorting to maintain the index relationship3. sort -- sorting from the lowest to the highest4. ksort -- sort by key name5. krsort-sort by key name in reverse order6. rsort-reverse sort (the highest to the lowest), delete the original key name, and assign the new key name [higher than the number](1) English only: $ fruits = array ("d" => "lemon", "a"
There are three built-in data structures in Python-lists, tuples, and dictionaries.1) lists list [,]A list is a sequence ofShoplist = [' Apple ', ' carrot ', ' banana ']Print shoplist #[' apple ', ' carrot ', ' banana 'Shoplist.append (' orange ') #末尾加入一个Print shoplist #[' apple ', ' carrot ', ' banana ', ' orange ']Shoplist.insert (2, ' Flint ') #指定位置插入Print sho
The group statement can put data with the same key valueAggregationTogether, there is an essential difference from group operations in SQL, where groups created by a group by sentence must be injected directly into one or more aggregate functions. There is no direct relationship between group and aggregate functions in pig Latin. The group keyword is as it is literally expressed:encapsulates all records containing the values corresponding to a particular key into a bag, after which the user can
before explaining the simple factory pattern, it is necessary to understand some of the principles of OO NBSP;1.OCP (opening and closing principles, open-closed principle): A software entity should be open to extension and closed to modifications. That is, for an existing software, if it needs to be extended, it should be done on the basis that there is no need to modify the existing code. 2.DIP (relying on the reverse principle, dependence inversion principle): To programming against the i
, but the associated keys are not affected. The format is as follows:
int array_unshift(array array,mixed variable[,mixed variable])
In the following example, two fruits are added before the $ fruits array:
$fruits = array("apple","banana");array_unshift($fruits,"orange","pear")// $fruits = array("orange","pear","apple","banana");
Add elements at the end of the array
The return value of the array_push (
The sorting of several array functions mentioned below has some commonality:The 1 array is used as the parameter of the sort function, and after sorting, the array itself is changed, and the return value of the function is type bool.
2 A single-a representation of association appears in the function name, meaning that the correspondence of Key=>value remains the same during sorting by value
3 A single k in the function name denotes key, meaning that it is ordered by the value of the array key in
, but the associated keys are not affected. The format is as follows:
int array_unshift(array array,mixed variable[,mixed variable])
In the following example, two fruits are added before the $ fruits array:
$fruits = array("apple","banana");array_unshift($fruits,"orange","pear")// $fruits = array("orange","pear","apple","banana");
Add elements at the end of the array
The return value of the array_push (
-Origin of morality- Five monkeys are locked in a cage, and a bunch of bananas on the top of the cage are equipped with an automatic device.Once it is detected that a monkey is going to get a banana, there will be water sprayed into the cage and the five monkeys will be wet.First, a monkey wants to get bananas. Of course, the result is that every monkey gets wet.After several attempts, each monkey found no such thingThe monkeys agreed that they shou
The introduction of git is not much said. Here is just a simple entry-level operation.
This section focuses on operations related to viewing and controlling historical versions.Everything is simple, not reasonable, but simple operations.Original article, if reproduced, please indicate the source: http://blog.csdn.net/yihui823/article/details/6681214
With Copper as the mirror, you can wear the crown;
Taking history as the mirror, you can know xingti;
With human eyes, you can understand the gains
Origin of MoralityPut the five monkeys in a cage with a bunch of bananas hanging on top.
Your ad here
The lab staff installed an automatic device. Once a monkey was detected to take bananas, it immediately sprayed into the cage, and the five monkeys were wet. First, a monkey wants to get a banana. Of course, the result is that every monkey is wet. Then, when every monkey tries several times, it cannot be found.
So the monkeys reached a consensus
Array_multisort ($arr, mixed)
The second parameter is the ability to change the sort behavior by value
Sort_regular Normal comparison unit sort_numeric unit is compared as a numberThe sort_string unit is compared as a string srot_locale_string the cell as a string based on the current local setting.
--------------------sort function Ascending order--------------------------------BOOL Sort (array $array [, int $sort _flags= sort_regular])
The code is as follows
Copy Code
Python deep copy and python copy
Python data structures are divided into two types:
1. String and number
2. List, tuples, and dictionariesI. Strings and numbers
For strings and numbers, assigning values (=), copying, and deepcopy is meaningless because they always point to the same memory address.
>>> Import copy >>> a1 = 100 >>> id (a1) 1426656816 # a1 memory address # assignment >>> a2 = a1 >>> id (a2) 1426656816 # shallow copy> a3 = copy. copy (a1) >>> id (a3) 1426656816 # Deep copy >>> a4 =
Learn about List:"" "More on Lists?Using Lists as Stacks."""Fruits = [' orange ', ' apple ', ' pear ', ' banana ', ' kiwi ', ' apple ', ' banana ']#Return the number of times X appears in the listPrint (Fruits.count (' apple '))Print (Fruits.count (' Tangerine '))#Return zero-based index in the list of the first item whose value is X.#list. Index (x[, start[, end]])Print (Fruits.index (' Kiwi ', 4))#Reverse
fully consistent and not chaizi. -+ denotes and, that must be included. -represents not, which must not be included. That is: The return record must contain Apple and cannot contain banner.
SELECT * from articles WHERE MATCH (title,content) against (' +apple-banana ' in BOOLEAN MODE);
--Between Apple and banana is a space, and a space indicates or. That is, the return record contains at least one of Apple,
----------------------------------------------------------------------------------------------------------------
The usage is as follows:
The Code is as follows:
SELECT * FROM articles where match (title, body)AGAINST ('+ apple-banana' in boolean mode );
+ Indicates AND, which must be included. -Indicates NOT, that is, NOT included.
The Code is as follows:
SELECT * FROM articles where match
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.