Exforsys
+ Reply to Thread
Results 1 to 3 of 3

How can I reset an array in PHP?

This is a discussion on How can I reset an array in PHP? within the PHP forums, part of the Programming Talk category; Sometimes if you are moving through the various elements in an array, you will want to return the pointer to ...

  1. #1
    rachelpit is offline Junior Member Array
    Join Date
    Feb 2011
    Location
    UK
    Answers
    4

    How can I reset an array in PHP?

    Sometimes if you are moving through the various elements in an array, you will want to return the pointer to the beginning of the array.This is easily done with the reset function.


  2. #2
    lokeshm is offline Member Array
    Join Date
    Apr 2005
    Answers
    83
    rachelpit,

    "reset" function will return the value of the first array element.
    You can reset your array by making use of PHP reset() function as shown below

    reset(<<array_name>>) ;

    Please Note that "reset" function will not clear the contents of the array, It will only move the internal pointer to the first element of the array.


  3. #3
    SeanL is offline Junior Member Array
    Join Date
    Feb 2011
    Answers
    13
    I've been stydying a little PHP recently and I can agree with lokeshm on this post.


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...