There's various ways to do this.
If your array is a sequentially zero-indexed array, you could do:
for( $i = 0, $ilen = count( $array ) - 1; $i < $ilen; $i++ )
{
$value = $array[ $i ];
/* do something with $value */
}
If your array is an associative array, or otherwise not sequentially zero-indexed, you could do:
$i = 0;
$ilen = count( $array );
foreach( $array as $key => $value )
{
if( ++$i == $ilen ) break;
/* do something with $value */
}