0

The Hello Dolly WordPress Plugin opens with an open bracket: <

<?php
/**
 * @package Hello_Dolly
 * @version 1.7.2
 */
/*
Plugin Name: Hello Dolly
Plugin URI: http://wordpress.org/plugins/hello-dolly/
Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
Author: Matt Mullenweg
Version: 1.7.2
Author URI: http://ma.tt/
*/

However, the last line contains

add_action( 'admin_head', 'dolly_css' );

But there is no closing bracket: >

Shouldn't PHP scripts have a closing bracket?

Justin
  • 407
  • 6
  • 16

1 Answers1

0

parsing the trailing ?> is trivial and won't make any noticeable difference at all, unless you're including a million files per second.

IIRC, php.net recommends NOT adding the ?>, and the reasons go something like this:

  1. it's unnecessary
  2. it is easy to accidentally add significant whitespace after the ?>, which will be output to the client, which in turn can lead to obscure 'headers already sent' errors (this happens when an included file contains whitespace, and you try to set a header after including that file)

references: https://softwareengineering.stackexchange.com/a/89560 and Why would one omit the close tag?

Adamski
  • 839
  • 2
  • 10
  • 28