My array :
$arr = array(\"jan\",\"feb\",\"mar\",\"apr\",\"mei\",\"jun\",\"jul\",\"agu\",\"sep\",\"okt\",\"nov\",\"des\");
then i do a foreach<
You can use the keys to get the previous key.
foreach($arr as $key => $ar){
$prev = $arr[$key-1];
echo "previous value -" .$prev;
}
You also have prev() as an internal array pointer:
$transport = array('foot', 'bike', 'car', 'plane');
$mode = current($transport); // $mode = 'foot';
$mode = next($transport); // $mode = 'bike';
$mode = next($transport); // $mode = 'car';
$mode = prev($transport); // $mode = 'bike';
$mode = end($transport); // $mode = 'plane';