+ ----------------------------------- ++ Part 1: php core technology-use of arrays (1) + ======= new content ===============================+ array pointer operations: move the array pointer: Next () gets the value of the current element at the same time. Prev () up simultaneously... "> <LINKhref ="
Array pointer operation:
Move the array pointer: Next () gets the value of the current element at the same time. The value of the current element is obtained when Prev () is up. Move End () to the last element unit to get the value of the last element. move Reset () to the first unit to get the value of the first element. If the operation fails, false is returned. Parameters are all arrays to be operated and are passed as references. Obtain the information of the element pointed to by the pointer: Key (); // Obtain the element subscript Current () pointed to by the Current array pointer (); // Obtain the elements pointed to by the current array pointer. only the data is retrieved without moving the pointer. There is also a hybrid operation: you can obtain the information (key value) of the current pointer element and move the pointer at the same time. Each (); obtains information about the current element (key and value. Move pointer: sometimes we can use the each feature to traverse the array: we should use the loop structure with each. Condition: when each reaches the last element, false is returned. List function: restriction of List: only applicable to index arrays. You can use list and each to complete traversal, but after using each to traverse, the array pointer will not be reset by reset. you need to manually reset the array pointer.