英 [i:t?] US [it?]

adj.Every; each; their own

pron. Each; their own

php each() function syntax

Function:Return the key name and key value of the current element, and move the internal pointer forward

Syntax: each(array)

Parameters:

##array Required. Specifies the array to use.
ParametersDescription

Description: Generate an array consisting of the key name and key value of the element pointed to by the current internal pointer of the array, and move the internal pointer forward . The returned array contains four elements: key 0, 1, key and value. Cells 0 and key contain the key names of the array cells, and 1 and value contain the data. If the internal pointer exceeds the range of the array, this function returns FALSE.

php each() function example

<?php
$a=array("php中文網(wǎng)","西門(mén)","講師","滅絕師太","無(wú)忌哥哥");
print_r(each($a));
?>

Run instance?

Click the "Run instance" button to view the online instance

Output:

Array ( [1] => php中文網(wǎng) [value] => php中文網(wǎng) [0] => 0 [key] => 0 )


<?php
$a=array("無(wú)忌哥哥","滅絕師太","講師","php中文網(wǎng)","西門(mén)");
print_r(each($a));
?>

Run Instance?

Click the "Run Instance" button to view the online instance

Output:

Array ( [1] => 無(wú)忌哥哥 [value] => 無(wú)忌哥哥 [0] => 0 [key] => 0 )