Why is PHP processing this line break?

Discussion in 'PHP' started by jwitt98, Mar 12, 2011.

  1. #1
    <?php if(isset($numPages_error_message)) {echo $numPages_error_message.'<br/>';} ?>
    PHP:
    Maybe I've been working too long. If $numPages_error_message is not set, why would php still process the line break at the end of the echo statement?
    The line break is processed whether it is set or not. What am I missing?
     
    jwitt98, Mar 12, 2011 IP
  2. jwitt98

    jwitt98 Peon

    Messages:
    145
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Never mind. I figured it out. I had $numPages_error_message = ''; in an included file.
    I changed the code to:
    <?php if(!empty($numPages_error_message)) {echo $numPages_error_message.'<br/>';} ?>
    PHP:
    and now it works the way I intended.
     
    jwitt98, Mar 12, 2011 IP
  3. awood969

    awood969 Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    40
    #3
    In answer to your question, yes you have been working too long! Lol.


    We've all been there!! Lol
     
    awood969, Mar 13, 2011 IP
  4. jwitt98

    jwitt98 Peon

    Messages:
    145
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Lol, yes that was it!
     
    jwitt98, Mar 13, 2011 IP