php reset() function


  Translation results:

英[ˌri:ˈset] 美[riˈsɛt]

vt.Reset; rearrange; reinstall

n.Replace; replay something

vi.Reset; clear

Third person singular: resets Present participle: resetting Past tense: reset Past participle: reset

php reset() functionsyntax

Function: Point the internal pointer to the first element in the array and output it.

Syntax: reset(array)

Parameters:

Parameter Description
array Required. Specifies the array to use.

Description: If successful, return the value of the first element in the array, if the array is empty, return FALSE.

php reset() functionexample

<?php
$people = array("西门", "灭绝", "无忌");
echo end($people); //指向最后一个元素 无忌
echo "<br>";
echo reset($people); //指向数组中第一个元素 西门
?>

Run instance»

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

Output:

无忌
西门
<?php
$people = array("欧阳克", "无忌", "Peter_zhu");
echo end($people); //指向最后一个元素 Peter_zhu
echo "<br>";
echo reset($people); //指向数组中第一个元素 欧阳克
?>

Run Instance»

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

Output:

Peter_zhu
欧阳克

Popular Recommendations

Home

Videos

Q&A