This article describes how to obtain the current array value of a php array. For more information, see. In the php array operation, you can use the current () function to return the array value of the current pointer position in the array. The format is as follows: mixed current (array) For example, obtain the array value:
"red", "banana"=>"yellow"); while ($fruit = current($fruits)) { printf("%s ", $fruit); next($fruits); } // by bbs.it-home.org// red // yellow ?> Define and use the current function. Define and use the current () function to return the current element (unit) in the array ). Each array has an internal pointer pointing to its "current" element, initially pointing to the first element inserted into the array. The current () function returns the value of the array element to which the current internal pointer points, without moving the pointer. If the internal pointer points to an end that exceeds the cell List, current () returns FALSE. Syntax current (array) The parameter description array is required. Specifies the array to be used. Tip and comment: if the element is empty or has no value, the function returns FALSE. Tip: This function does not move internal pointers. To do this, use the next () and prev () functions. Example:
";//by bbs.it-home.org?> Output result: Peter This article describes how to use current () to obtain the current value of the array. We hope this will help you. |