Re: Making a variable -Trim output
| From: | Clayton Dukes | Date: | Mon, 26 Feb 2001 16:43:08 +0000 |
| Subject: | Re: Making a variable -Trim output | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41700@lists.php.net to get a copy of this message | ||
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");
> }
>
>
>
> -----Original Message-----
> From: Clayton Dukes [mailto:cdukes@cdukes.com]
> Sent: Monday, February 26, 2001 8:17 AM
> To: php-general@lists.php.net
> Subject: [PHP] Making a variable
>
>
> How can I make this a variable?
>
> ie:
>
> foreach (file("$file.txt") as $line) {
> print ("" . trim(str_replace("'", "''", $line))
> . "\n");
> }
>
> changed to:
>
> $data = foreach (file("$file.txt") as $line) {
> print ("" . trim(str_replace("'", "''", $line))
> . "\n");
> }
>
> Simply adding the $data = in front of it doesn't work, I assume it needs
to
> be enclosed by () or ; or something right?
>
>
> Thanks :-)
>
>
> Clayton Dukes
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net