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
Auf dieser Seite können Sie das Online-Video 19-How to using each function in PHP | Array | PHP Developer mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Professional Skill 2023 13 Februar 2025 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 27 Mal angesehen und es wurde von 3 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!