PHP study notes 02 array 1. create an array: $ users = array ("a", "B"); change the value of the array $ users [0] = "c"; for ($ I = 1; $ I & lt; 10; $ I ++) {& nbsp; $ users [$ I];} count the number of arrays count () foreach ($ usersas $ ke PHP study notes 02
Array
1. create an array:
$ Users = array ("a", "B ");
Change the value of the array $ users [0] = "c ";
For ($ I = 1; $ I <10; $ I ++ ){
$ Users [$ I];
}
Count ()
Foreach ($ users as $ key => $ value ){
Echo $ value;
}
Create an array of custom keys
$ Test = array {"key" => "value "}
Access Data $ test ["key"]
Append an array
$ Test ["new"] = "test ";
List ($ a, $ B) copies the array data to $. List can only recognize arrays of subscript digits. The custom string key cannot be identified.
Rest () points the array pointer to the first unit
Array_unique remove duplicate values
Array_flip swap the key and value of the array
Two-dimensional array:
$ Array = array (...))
An array can contain multiple variables of different types.
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