This is useful when using next() and prev() function in a while loop to
traverse an array.
For example the following code will only
output up to 8.
<?php
$test[] = "1";
$test[]
= "2";
$test[] = "3";
$test[] =
"4";
$test[] = "5";
$test[] =
"6";
$test[] = "7";
$test[] =
"8";
$test[] = "9";
$test[] =
"10";
$test[] = " ";
$test[] = "
";
$test[] = " ";
$count =
count($test);
while($i < $count) {
$now =
current($test);
echo
"$now
";
next($test);
next($test);
next($test);
prev($test);
prev($test);
prev($test);
$i++;
next($test);
}
?>
But
if you use:
$test = array_pad($test, 13, " ");
you
will get all of your output.