PHP each() Function
The each() function is an inbuilt function in PHP and is used to get the current element key-value pair of the given array to which the internal pointer is currently pointing. After returning the key and value of the current element the internal pointer is incremented by one in the array.
Definition and Usage
The each() function returns the current element key and value, and moves the internal pointer forward.
Note: The each() function is deprecated in PHP 7.2.
This element key and value is returned in an array with four elements. Two elements (1 and Value) for the element value, and two elements (0 and Key) for the element key.
Related methods:
1-current() - returns the value of the current element in an array
2-end() - moves the internal pointer to, and outputs, the last element in the array
3-next() - moves the internal pointer to, and outputs, the next element in the array
4-prev() - moves the internal pointer to, and outputs, the previous element in the array
5-reset() - moves the internal pointer to the first element of the array
Syntax
each(array)
Parameter Values
Parameter Description
array Required. Specifies the array to use
En esta página del sitio puede ver el video en línea 19-How to using each function in PHP | Array | PHP Developer de Duración hora minuto segunda en buena calidad , que subió el usuario Professional Skill 2023 13 febrero 2025, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 27 veces y le gustó 3 a los espectadores. Disfruta viendo!