Random php Whitespace

Discussion in 'PHP' started by Silver89, Mar 12, 2008.

  1. #1
    I'm getting some random php whitespace that i can't get rid of,

    Im selecting the data from the table and then directly echoing it using:

    
    
    echo 'aaa'.$row[0].'aaa';
    
    $page=str_replace(' ', '',$row[0]);
    
    echo 'aaa'.$page.'aaa';
    
    
    PHP:
    Output:
    
    aaa ResultText aaa
    
    aaa ResultTextaaa
    Code (markup):
    I don't understand why all whitespace isn't being removed?
     
    Silver89, Mar 12, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Try:
    
    echo 'aaa'. trim($row[0]) .'aaa';
    
    PHP:
    Note that the browser interprets new lines as spaces as well. You can probably see them in the source code.
     
    nico_swd, Mar 12, 2008 IP