Re: [PHP-WIN] Re: [Linux dev] Undefined variables

2006-09-10 Thread Stut
Please reply to the list not just directly to me. Alf Stockton wrote: > Stut wrote: >> ..snip.. > >>// Really not sure why this is here >>--$Count; >>//echo 'Count = '.$Count.' $tempvar = '.$tempvar; >> > .snip. > Part of the backwards iteration. In other word

[PHP-WIN] Re: [Linux dev] Undefined variables

2006-09-10 Thread Alex Turner
Alf Stockton wrote: Hendrik Visage wrote: On 9/8/06, Alf Stockton <[EMAIL PROTECTED]> wrote: In this little script:- Obviously $names won't be defined in the initial state the first time this line is hit, thus count($names) would/should be undefined... Interesting that this works on version

[PHP-WIN] Re: [Linux dev] Undefined variables

2006-09-09 Thread Alf Stockton
Hendrik Visage wrote: > On 9/8/06, Alf Stockton <[EMAIL PROTECTED]> wrote: >> In this little script:- >> >> > session_start(); >> //read folder >> $folder=opendir("."); >> while ($file = readdir($folder)) >> $names[count($names)] = $file; // <- Line 8 > > Obviously $names won't be defined in t

Re: [PHP-WIN] Re: [Linux dev] Undefined variables

2006-09-08 Thread Alex Turner
Foreach is very much better as it does not mean having to traverse the array to find the given value. If you have a long array, you'll find looking up a element by index gets slow. AJ Stut wrote: Hendrik Visage wrote: right> The rewrite below does not iterate around the array as you were i

Re: [PHP-WIN] Re: [Linux dev] Undefined variables

2006-09-08 Thread Stut
Hendrik Visage wrote: The rewrite below does not iterate around the array as you were in your for loop, so I'll mention a better way to do that here rather than in the snippet below... foreach - look it up in the PHP manual! One way to rewrite it would be like this (with comments hopefully

[PHP-WIN] Re: [Linux dev] Undefined variables

2006-09-08 Thread Hendrik Visage
On 9/8/06, Alf Stockton <[EMAIL PROTECTED]> wrote: In this little script:- Obviously $names won't be defined in the initial state the first time this line is hit, thus count($names) would/should be undefined... closedir($folder); //sort file names in array sort($names); //remove any non-imag