About arrays

xiaoxiao2021-03-06  111

Written in front: Recently I have learned PHP, if you like friends, you can come here to see. One-dimensional array: ";}?> Take the results: 01Word23 Look at the results: If you like the program You just start learning if you have any questions if you like my study notes, please come here to array () "Name", "Address" => "Address", "Work" => "Work"); // Use a continuous digital subscript, starting from 0 $ VAR_ARRAY = Array ("Language", "Mathematics", "English"); / / Use the jumping digital subscript, reference to "Java Language", use the subscript 5, reference "PHP language", use the subscript 6. $ VAR_ARRAY = Array ("C Language", 5 => "Java Language", " PHP language "); // The output of the result (three can be used): / * for ($ I = 0; $ I

Array Sort Example 1:
Arsort () Sort array
$ TEMP [Value]
";}?> < BR> Example 2:
Sort () The index of the associated array does not exist, the array elements are sorted in the Dictionary.
$ TEMP [value ]
";}?>
Example 3:
Ksort () array in accordance with the keyword dictionary number, the corresponding relationship between keywords and values ​​does not change.
"Joe", "Work" => "teacher", "SEX" => "Male"); Ksort ($ VAR_ARRAY); RESET ($ VAR_ARRAY); for ($ I = 0; $ I <3; $ I ) {$ TEMP = Each ($ VAR_ARRAY); Echo "$ TEMP [key] = $ TEMP [Value]
";}?>
Example 4:
Asort ) Press the array
"joe", "work" => "teacher", "sex" => "Male"); Asort ($ VAR_ARRAY) Reset ($ VAR_ARRAY); For ($ I = 0; $ I <3; $ I ) {$ TEMP = Each ($ VAR_ARRAY); Echo "$ TEMP [key] => $ TEMP [Value]
}?>
Example 5: Rsort: Array elements Arrange in reverse sequence in dictionary.
"joe", "Work" => "teacher", "SEX" => "Male"); RSORT ($ VAR_AARRAY); RESET ($ VAR_ARRAY); for ($ I = 0; $ I <3; $ I ) {$ TEMP = Each ($ VAR_AARRAY); Echo "$ TEMP [Key] = $ TEMP [Value]
";}?>

转载请注明原文地址:https://www.9cbs.com/read-101240.html

New Post(0)