Php5 and mysql5web Development Technical details 1-php array _ PHP Tutorial

Source: Internet
Author: User
Php5 and mysql5web Development Technical details 1-php array. 1. create immediately or extract range () to quickly create an array of specified element values. Example: range () range (, 2) range (a, z) shuffle () disrupt the array order array_rand () specify 1, then create or then extract

Range () quickly creates an array of specified element values.

Example:

Range (0, 6)

Range (0, 10, 2)

Range ('A', 'z ')

Shuffle () disrupts the array order

Array_rand () specifies the number of elements to be extracted immediately. If you extract an element and return a variable, multiple elements are extracted and the index array is returned.

2. array sorting

Sort () sorting by ASCII code priority: numbers, letters, Chinese characters

Asort () is sorted by array associativity

Ksort () in ascending order of array index values

Krsort () in descending order of array index values

3. statistical functions

Array_count_values

Array_sum (array $ a) array element sum

Count ()

Sizeof ()

4. array processing

Array_combine (array a1, array a2) array merges a1 as the key name, and a2 as the key value

Array_unique (array $)

Array_flip () key-value reconciliation

5. search

Array_key_exists ($ key_str, $ array)

In_array ($ value_str, $ array, [bool])

6. move the internal pointer of the array

Current ()

Next ()

Prev ()

End ()

7. get the joined array key name

Key ()

8. access the key and key value of the array

Array_keys ()

Array_values ()

9. determine the array type (to be supplemented)

Is_array ()

10. display content and structure

Print_r ()

Var_dump ()

Var_export ()

11. insert and remove elements

Unset ()

Array_shift ()

Insert at the top of array_unshift ()

Array_splice ()

Array_push ()

Array_pop ()

12. export content as a variable

Extract ()

13. others

List ()

Each ()

For ()

Foreach ()

Distance is created immediately or range () is extracted immediately to create an array of specified element values. For example, range () range (, 2) range (a, z) shuffle () breaks down the array order specified by array_rand...

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.