you should not be using the internal array pointer for this. that is not what it is designed for, and some operations may modify it unexpectedly.
use indexes, like sde suggested.
PHP Code:
<?
$position = array_search($pic,$imageArray);
// get the next pic
$position++;
$next_pic = $imageArray[$position];
?>
if your arrays are hashed (key-based), use the each() function or similar.