Php common array application description (1/2) _ PHP Tutorial

Source: Internet
Author: User
Php common array application description (12 ). Ange ($ low, $ high), range ($ low, $ high, $ step); create an array of sequential values, for example, range () is) for example, range (a, z) each ($ array) returns the current element of the array in sequence, and returns the next ange ($ low, $ high), range ($ low, $ high, $ step); // create an array of sequential values, for example, range () is (,) and range ('A', 'z ')

Each ($ array) returns the current element of the array in sequence, and sets the next element as the current element;

Reset ($ array) to reset the current element of the array to the beginning of the array

List () can be used to break an array into a series of values, such as list ($ a, $ B) = each ($ array)

Shuffle ($ array), array_rand ($ arg, $ num_req); random sorting of arrays

Array_reverse ($ input), array_reverse ($ input, $ preserve_keys) returns the reverse sorting of the original array

Sort ($ array); sorts arrays

Php Tutorial array is an important concept. it contains a large number of functions to facilitate people's development... Now we classify its arrays to facilitate query and application.
Let's talk about the definition of php array... The php array contains two items: key and value. you can use the key to obtain the corresponding value. The key can be a value and associated, for example, $ array [0]. $ array [one]…
Create an array
The array declaration in php is a little different from that in other languages, but it can also be declared as one-dimensional, two-dimensional, three-dimensional and multi-dimensional, such
$ Array [0] = 1, $ array = array (, 3); one-dimensional array, which contains only three values and belongs to a numeric array, $ array [0] can be used to represent 1 during Reference. indexes can be omitted when a numeric array is created.

$ Array = array (
1 => "one ",
2 => "two ",
3 => "three ",
4 => array (
"One" => 1,
"Two" => 2,
"Three" => 3
)
);

A two-dimensional array is also an associated array. you can use $ array [4] ["one"] to represent 1.
3D or above...
If you want to create arrays in batches, you can use the following function:
Array range (mixed low, mixed high [, number step])
For example, $ array = range (); indicates array );
$ Array = range (a, f); represents array (a, B, c, d, e, f );

Output array
Php outputs many array functions, commonly used
Bool print_r (mixed expression [, bool return])
Void var_dump (mixed expression [, mixed expression [,...])
Also, echo, print, and printf can output a single array.

1 2

Http://www.bkjia.com/PHPjc/631343.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/631343.htmlTechArticleange ($ low, $ high), range ($ low, $ high, $ step); // create an array of sequential values such as: range () is) for example, range ('A', 'z') each ($ array) returns the current element of the array in sequence, and returns the next...

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.