[PHP] How can I reset an array?

Newbie Spellweaver
Joined
Feb 24, 2011
Messages
60
Reaction score
5
this what I have i have done this with
PHP:
reset($array);

my code:
PHP:
<?php 
$numbers = array("This is 1","This is 2","This is 3"); 
next($numbers); 
$thisvalue = current($numbers); echo "We are now at $thisvalue\n\n"; 
$first = reset($numbers); 
echo "Back to $first"; 
?>
 
Last edited:
try (void)array (haven't a clue the result of this practice)

or simply
delete []array;

to delete, thereafter you could initialize and set new initiatives again.

or, get the length of the array, and use for loop and set to 0

oh, you're using php

mm, i think i've hassled myself quite enough. i'll get back to it.

meanwhile, temporarily wait for others or search google "reset array php"
 
Last edited:
If what u are trying achieve is what i think...

<?php
$temparray = array("Ele 1", "Ele 2", "Ele 3" };
$tempArrayIndex = 3;
echo "We are at index $tempArrayIndex with the value ".$temparray[$tempArrayIndex];
echo "Lets go back to the first!";
$tempArrayIndex = 0;
echo "We are at index $tempArrayIndex with the value ".$temparray[$tempArrayIndex];
?>

Is that what ur trying to do? = ="
 
If what u are trying achieve is what i think...

<?php
$temparray = array("Ele 1", "Ele 2", "Ele 3" };
$tempArrayIndex = 3;
echo "We are at index $tempArrayIndex with the value ".$temparray[$tempArrayIndex];
echo "Lets go back to the first!";
$tempArrayIndex = 0;
echo "We are at index $tempArrayIndex with the value ".$temparray[$tempArrayIndex];
?>

Is that what ur trying to do? = ="

no just no
 
maybe he is trying to do this:
PHP:
<?php  
$numbers = array("This is 1","This is 2","This is 3");  
next($numbers);  
$thisvalue = current($numbers); echo "We are now at $thisvalue\n\n";  
reset($numbers);
$first = current($numbers);
echo "Back to $first";  
?>
 
Back