Tutorial on array operation_php

Source: Internet
Author: User
Array operation. PHP also supports scalararray and associativearrays ). In fact, there is no difference between the two. You can use the list () or array () function to create an array. PHP also supports scalar array and associative arrays ). In fact, there is no difference between the two. You can use the list () or array () function to create an array, or you can explicitly set the value of each array element.
$ A [0] = "abc ";
$ A [1] = "def ";
$ B ["foo"] = 13;
You can also create an array by adding values to the array.
$ A [] = "hello"; // $ a [2] = "hello"
$ A [] = "world"; // $ a [3] = "world"
Arrays can be sorted by the functions asort (), arsort (), ksort (), rsort (), sort (), uasort (), usort (), and ksort, the specific function should be set based on the sort type you want.
You can use the cunt () function to count the number of elements in the array.
You can use the next () and prev () functions to traverse arrays. Another common way to traverse arrays is to use the each () function ().

Scalar (scalar array) and associative array (associative arrays ). In fact, there is no difference between the two. You can use the list () or array () function to create an array ,...

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.