The current () function returns the value of the present element in the array.
Each array has an internal pointer to its "current" element, which initially points to the first element inserted into the array.
End ()-Points the inner pointer to the last element in the array and outputs
Next ()-Points the inner pointer to the next element in the array and outputs
Prev ()-Points the internal pointer to the previous element in the array and outputs
Reset ()-Points the inner pointer to the first element in the array and outputs
each ()-Returns the key name and key value of the current element and moves the internal pointer forward
<?PHP$tmp=Array(' A ', ' B ', ' C ', ' d ');Echo Current($tmp)." \ n ";Echo End($tmp)." \ n ";Echo Current($tmp)." \ n ";Reset($tmp);Echo Current($tmp)." \ n ";?>
Output
A
D
D
A
Therefore, it is best to reset the first element of the array with current because the pointer does not necessarily point to the first element in the array.
PHP gets the first element of the array and the last element