#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Pune, Maharashtra, India
    Posts
    86
    Rep Power
    15
    I am using PHP4 does it have any function such that it opens a file and deletes all the empty lines from the file.Does PHP have any inbuild function if NO Please give how can we do that using scripts.
    Thanks in advance.
  2. #2
  3. No Profile Picture
    RyanP
    Guest
    Devshed Newbie (0 - 499 posts)
    try this<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre><?php
    $lines = file("somefile.ext");

    while(list($key, $val) = each($lines))
    {
    if($val == "rn")
    {
    unset($lines[$key]);
    }
    }

    $line = implode("", $lines);

    $fileh = fopen("somefile.ext", "w");
    fwrite($fileh, $line);
    fclose($fileh);
    ?>[/code]

    [This message has been edited by RyanP (edited August 30, 2000).]
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Pune, Maharashtra, India
    Posts
    86
    Rep Power
    15
    What is this 'r' equivalent to I only know 'n' for next line and 't' for tab and some others can U provide me with listig of such equivalents to me. This will be quite a big help.
    Thanks in advance.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Pune, Maharashtra, India
    Posts
    86
    Rep Power
    15
    Got the list of escape characters if anybody interested he can visit : http://www.php.net/manual/html/langu...es.string.html
    But yet cannot remove all the empty lines I dont know why all the empty lines do not tend to get lost.Help needed please.
    Thanks in advance

    ------------------
    Nikunj Virani
    MYSQL/PHP/XML
    This is the world of Nikunj

    [This message has been edited by nikunj (edited August 30, 2000).]

Similar Threads

  1. Uploading Files
    By vivekjain in forum ASP Programming
    Replies: 0
    Last Post: February 17th, 2004, 12:21 AM
  2. Pointer problem in opening a file
    By LAKI in forum C Programming
    Replies: 13
    Last Post: February 11th, 2004, 09:27 AM
  3. Pointer problems opening file *formatted*
    By LAKI in forum C Programming
    Replies: 4
    Last Post: February 11th, 2004, 07:06 AM
  4. Replies: 1
    Last Post: February 8th, 2004, 02:59 PM
  5. load external html file in an empty movieclip
    By musher5 in forum Flash Help
    Replies: 2
    Last Post: January 29th, 2004, 01:00 AM

IMN logo majestic logo threadwatch logo seochat tools logo