Mobile app interface programming technology-Learning and implementation-PHP advanced array
Array creation and initialization
'Dashboard ', '2' => 'Old three', '1' => 'dashboard '); if (isset ($ arr3 )) {print_r ($ arr3) ;}?>
Use the array value
Print the data of the array
// Access through index directly
';}?>
// Use foreach to loop the values in the number Group
"I", 'love' => 'love', 'u' => 'you'); if (isset ($ arr )) {foreach ($ arr as $ key => $ value) {echo $ value. '';}}?>
Summary
PHP array is dividedIndex array Join array
The associated array is an array where the key value is a string.
For example, the foreach example in the previous example.
"I", 'love' => 'love', 'Lil' => 'Lil'); if (isset ($ arr )) {foreach ($ arr as $ key = >$ value) {print_r ($ value); // echo $ value ;}}?>
Create and initialize associated arrays
'Apple'); $ arr = array (); $ arr ['apple'] = 'apple'; if (isset ($ arr )) {print_r ($ arr) ;}?>
Join array reference (use the name of the array variable followed by brackets + keys to access the values in the array. The key is enclosed by single quotation marks or double quotation marks .)
"Apple", 'bana' => "banana", 'pineapple' => "pineapple"); $ arr0 = $ arr ['apple']; if (isset ($ arr0) {print_r ($ arr0) ;}?>