in middle of my code i want to reset my array.
Enter your PHP question at the top of this page and click Get An Answer.
Tell us how quickly you want your PHP question answered.
Connect with your programmer via online chat or telephone call.
in middle of my code i want to reset my array.
You can do this easily done with the reset function, like this:
reset($array);
This returns the first element and sets it as the current element.
Here is a little example just to make this technique clear:
<?php
$numbers = array("Item 1","Item 2","Item 3");
next($numbers);
$thisvalue = current($numbers); echo "We are now at $thisvalue\n\n";
$first = reset($numbers);
echo "Back to $first";
?>
nice answer and thanks for the example.
Byron Narciso
Programmer
Whether you have a quick question while preparing your taxes, troubleshooting a computer problem, or need to hire an attorney, ExpertHelp is the most convenient and affordable way to connect with the right service professional to get the job done.
ExpertHelp has been in business since 2011, is an A+ Rated Better Business Bureau accredited member, and offers a 100% satisfaction guarantee on every question you ask!