> $i = 1;
> foreach ($dirs as $value) {
>  if ($i == ($numberofelements-1)) $lastdir = $value;
>  if ($i == $numberofelements) $file = $value;
>  $i++;
> }

I don't think the foreach is necessary - Why can't you just say:

$lastdir = $dirs[$numberofelements-1];
$file = $dirs[$numberofelements];

That way you're not traversing the entire array, you're just getting what
you need, more efficient. Now if only you could work with files the same way
you can with arrays...


-- 
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