Hi, I'm getting some weird behavior from prev() and next(). If anyone knows
what's going on please let me know. Also, please make sure you e-mail me
personally in addition to the list.

Anyway, here's the problem. Check out the following code:

<?php
$arr = Array(1, 2, 3, 4);

echo current($arr) . "<br>"; #prints out 1
echo next($arr) . "<br>"; #prints out 2
echo next($arr) . "<br>"; #prints out 3
echo next($arr) . "<br>"; #prints out 4
echo prev($arr) . "<br>"; #prints out 3
echo prev($arr) . "<br>"; #prints out 2
echo prev($arr) . "<br>"; #prints out 1
?>

It does the expected and prints out 1234321 (without the <br>s). However, if
I add one more call to next() in there, it only prints out 1234. It seems
like the call to next that goes past the end of the array sort of "breaks"
it so you can't go back again. If I do a call to end() it prints out 4, so
the array still 'works', but I can't get back using prev(). Anyone know why?
Thanks!

Keith


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to