remove

Discussion in 'PHP' started by jjj02, Mar 16, 2008.

  1. #1
    I have a file(s) with line spaces in, and I need to read it without the line spaces.

    Can someone please tell me how I can remove all line spaces?
     
    jjj02, Mar 16, 2008 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    if these are php files or any text based files you can use pspad and it has option to delete blank lines

    Regards

    ALex
     
    kmap, Mar 17, 2008 IP
  3. Freewebspace

    Freewebspace Notable Member

    Messages:
    6,213
    Likes Received:
    370
    Best Answers:
    0
    Trophy Points:
    275
    #3
    line spaces means

    "line1 ...................................."
    "line2...................................."

    whether like this?

    better you can use explode() function
     
    Freewebspace, Mar 17, 2008 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    No explode() needed:
    
    $lines = file('some-file.txt');
    $good_lines = array_filter($lines, 'trim');
    
    PHP:
    ... if I understood your (poorly explained) problem.
     
    nico_swd, Mar 17, 2008 IP