$prev = ($i == 0) ? $total : $i-1; cra$h / superfertile : Dan Wilton