RE: [PHP] Making a variable -Trim output

From: Date: Mon, 26 Feb 2001 17:02:29 +0000
Subject: RE: [PHP] Making a variable -Trim output
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-41703@lists.php.net to get a copy of this message
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 -----Original Message----- From: Clayton Dukes [mailto:cdukes@cdukes.com] Sent: Monday, February 26, 2001 8:43 AM To: Dan Olsen; php-general@lists.php.net Subject: Re: [PHP] Making a variable -Trim output Thanks again, Is there a way I can tell it to print all but the first 13 lines and the last two lines of the text file? -Clayton ----- Original Message ----- From: "Dan Olsen" <dolsen@informano.net> To: <php-general@lists.php.net> Sent: Monday, February 26, 2001 11:39 AM Subject: RE: [PHP] Making a variable > > you can concatentate the variable inside the foreach loop. > > foreach (file("$file.txt") as $line) { > $data .= ("" . trim(str_replace("'", "''", > $line)) . "\n"); > } > > >

« previous php.general (#41703) next »