Search DaTutorials:  
HOME
Php Tutorials
Articles
Basics
Date and Time
File Manipulations
Forms
Functions
General
Interactivity
MySql
Navigation
News,Shoutboxes and Blogs
Language Structure and Data Types
Searching
Security
String Manipulation
User Information and Stats
Search For a Tutorial
Php Reference

reset

(PHP 3, PHP 4 , PHP 5)

reset --  Set the internal pointer of an array to its first element

Description

mixed reset ( array array)

reset() rewinds array's internal pointer to the first element and returns the value of the first array element.

Example 1. reset() example

<?php

$array
= array('step one', 'step two', 'step three', 'step four');
 
// by default, the pointer is on the first element 
echo current($array) . "<br />\n"; // "step one"

// skip two steps   
next($array);                               
next($array);
echo
current($array) . "<br />\n"; // "step three"
 
// reset pointer, start again on step one
reset($array);
echo
current($array) . "<br />\n"; // "step one"
 
?>

See also current(), each(), next(), and prev().



Copyright © 2001-2004 The PHP Group
All rights reserved.

     Car Insurance | Car Insurance | Loans | Loans | News
Home     Link To Us     Ad With Us     Contact Us     Tell A Friend     Affiliates     Blog     MsOfficeHelp