Methods to initialize arrays: unified initialization or item-by-item initialization.
Methods to traverse the array:
1. FOR loop
2. DO...WHILE statement
3. WHILE statement
4. foreach
<span>foreach</span>(<span>$arr</span><span>as</span><span>$key</span>=><span>$val</span><span>) { </span><span>echo</span><span>$key</span>."=".<span>$val</span>."<br/>"<span>; }</span>
The key value in the array can be an integer or is a string.
Arrays can store any data type.
Understand content: array operators.
Array sorting problem:
Internal sorting:
1. Bubble sort
2. Selection sort
3. Insertion sort
4. Quick sort
External sorting:
About function parameters The problem:
When the formal parameter takes the address character: it means that the address is passed, that is, the address in the original array is passed, and the original value will be changed.
When the formal parameter does not take the address character: the default transfer is value transfer, not address transfer, that is, a brand new array transfer, and the value of the original array will not be changed.
Other knowledge:
Commonly used functions:
1. count
<span>count</span>(<span>$arr</span>); <span>//</span><span>获取数组的长度</span>
2. is_array: Determine whether it is an array.
3. print_r: Displays easy-to-understand information about a variable. If given a string, integer or float, the variable value itself will be printed. If array is given, keys and elements will be displayed in a certain format. object is similar to an array.
4. var_dump: Returns the type and value of the expression.
5. explode: Use one string to split another string.
6. Round: Round floating point numbers to a specified number of digits.
7. Unset: Destroy an element or a variable.
After a variable is destroyed in the array, the array will not be automatically reorganized, and the data corresponding to the key value in the array is undetermined
8. How to turn off notice level prompts in PHP:
1. Modify the php.ini file to: error_reporting = E_ALL & ~E_NOTICE
2. Add code to the page where you want to disable error prompts: error_reporting(E_ALL ^ E_NOTICE);
The above introduces the PHP study notes (1) array, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.