Photoshop learns the operation of array values for PHP learning

Source: Internet
Author: User

1. Extraction of values
In PHP, a list is used to extract the values in the array, such as list ($a, $b) = $array. If the value in the list is more than the number of arrays, the extra value in list is set to NULL. You can also use commas to jump through values in the array, such as list ($a, $b) = $array.

2. Dividing an array
If you want to get a subarray, you can use Array_slice (array, offset, length) to get. It returns an array with a new subscript starting at 0. If the index of the original array is a string, it seems that there is no meaning, it is best not to use, you can use Array_splice to get the substring.

3. Dividing the array into multiple arrays
Use Array_chunk to divide an array into a two-dimensional array. Detailed information can be seen through the official description of the link.

4. Keys and values
Array_keys ($array), gets an array of array indexes
Array_value ($array), gets an array of array values, and the index is reassigned starting from 0.
Array_key_exists ($key, array), whether the element exists for checking.
Array_splice, delete the insertion element.

5. Conversions between arrays and variables
Extract (array) to change an array into a variable
Compact () turns the variable into an array

The above describes the Photoshop learning PHP Learning array values, including the content of Photoshop learning, I hope the PHP tutorial interested in a friend helpful.

  • 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.