SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast Jujubee's Avatar
    Join Date
    Mar 2001
    Location
    Canada
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I want to run a scirpt the creates a HTML file on the drive. This file will later be INCLUDE()-ed in a PHP file.

    I did a search here and one thread mentioned simply concatenating all output to a variable, and then executing a fwrite($variable).

    While the above does solve my problem, it requires a ' $variable .= ' before each output line, and is kind of messy for my anal tendencies.

    Is there a more elegant method?

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, an alternative would be

    $variable = "foo ";
    fwrite($variable);
    $variable = "bar ";
    fwrite($variable);

    etc...

    You should be thankful that php allows you to use .= as an operator to concatenate a string. Its not so easy in C.
    Last edited by freakysid; Mar 7, 2001 at 21:56.

  3. #3
    SitePoint Enthusiast Jujubee's Avatar
    Join Date
    Mar 2001
    Location
    Canada
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm, while your method would also work, it seems like it would make the code even messier, no?

    I'm new at this PHP stuff, so I may be missing something.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •