Support » Fixing WordPress » No PHP closing tag in config file?

  • Resolved complaintbucket

    (@complaintbucket)


    greetings,

    Ok, maybe I’m going to look like a fool; however, I like to learn new things. Why is there PHP NO closing tag in wp-config.php?

    Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • There is in mine.

    Same here, and there should be too. There’s also one in the config-sample file…

    You don’t need to have a closing tag for PHP files..

    In some cases it’s considered good practice to leave the closing tag out.

    esmi

    (@esmi)

    Forum Moderator

    Really? When?

    When you are distributing files and can expect users to be using dodgy editors that add extra lines or erroneous spaces on the end of files….. and such…..

    It’s quite easy for extra spaces to end up on the end of a file, and if you’re using several includes tracking these spaces down can be a pain, especially if you’re dealing with lots of files… spaces after closing PHP tags is known to cause various issues including invalid headers…

    Of course there are cases when not using closing tags causes problems to, so it’s catch 22…

    me too,no close tag, but is it accept on old php version?

    Not using the closing tag is one of the recommended PHP coding practice. like t31os_ told. great explanation dude :-bd

    It’s optional, and safe to leave off – plus you save quite a few headaches removing it from wp-config.php. If it’s good enough for PHP.net, Drupal, and Zend, it’s good enough for me.

    [moderated–link removed.]

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘No PHP closing tag in config file?’ is closed to new replies.