Dan... You are the man, thanks! :-) ----- Original Message ----- From: "Dan Olsen" <[EMAIL PROTECTED]> To: "Clayton Dukes" <[EMAIL PROTECTED]> Sent: Monday, February 26, 2001 12:30 PM Subject: RE: [PHP] Making a variable -Trim output > > clayton- > > the only problems were syntactic. > > there was an extra $ on the filename for file.txt, and there were no $'s on > the loop variable i (happens to me all the time, switching from perl to > java(script) to php depending on what day it is). > > this code compiles and runs fine. > > <? > > $arrayoflines = file('file.txt'); > $arraysize = sizeof($arrayoflines); > $limit = $arraysize - 2; > $output = ""; > > for ( $i=0; $i<$arraysize; $i++) { > if ( ($i>12) && ($i<$limit) ) { > $output .= $arrayoflines[$i]; > } > } > > print $output; > > ?> > > enjoy, > DanO > > > > -----Original Message----- > From: Clayton Dukes [mailto:[EMAIL PROTECTED]] > Sent: Monday, February 26, 2001 9:08 AM > To: Dan Olsen > Subject: Re: [PHP] Making a variable -Trim output > > > Thanks so much for your help Dan, > > here's what I get when I try it: > > Parse error: parse error, expecting `';'' in - on line 7 > > line 7 is: > for (i=0; i<\$arraysize; i++) { > > any ideas? > > > ----- Original Message ----- > From: "Dan Olsen" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, February 26, 2001 12:02 PM > Subject: RE: [PHP] Making a variable -Trim output > > > > > > yes but you might want to use a for() loop instead since you know what you > > want. > > > > $arrayoflines = file("$file.txt"); > > $arraysize = sizeof($arrayoflines); > > $limit = $arraysize - 2; > > > > for (i=0; i<$arraysize; i++) { > > if ( (i>12) && (i<$limit) ) { > > $output .= $arrayoflines[i]; > > } > > } > > > > you'll have to debug, but it should work. > > > > DanO > > > > -- 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]