----- Original Message -----
From: "Paul Furman" <[EMAIL PROTECTED]>
> Totally ignorant need for clarification... Should I set up a counter for
> loops $integer++ or if I'm going through something, the while function
> knows to just go through those and fills in array numbers accordingly?
[snip]
> while ($file = readdir($dh)){
> if (strstr ($file, '.jpg')){
> $pictures[] = $file;
> }
With this syntax, you do not need to keep an $integer variable for the array
key. When you use $array[] = "something", it just assigns that value to the
next available numeric key.
while ($file = readdir($dh)){
if (strstr ($file, '.jpg')){
$pictures[$int++] = $file;
}
Would also be correct, if you wanted to keep the count yourself. You could
also use array_push().
Just make sure $pictures is defined as an array before you try to push a
value onto it (even using the method you have now), otherwise you'll get a
warning.
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php