19-How to using each function in PHP | Array | PHP Developer

Publicado em: 13 Fevereiro 2025
no canal de: Professional Skill 2023
27
3

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


Nesta página do site você pode assistir ao vídeo on-line 19-How to using each function in PHP | Array | PHP Developer duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Professional Skill 2023 13 Fevereiro 2025, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 27 vezes e gostou 3 espectadores. Boa visualização!