Odd PHP Code To Display HTML Of Meta Box [closed]

Sometimes when working with a larger block of HTML it is easier to just close your PHP tags and type the HTML directly instead of trying to echo your HTML within PHP. Yes, you should be able to echo your HTML as well.

Edit: I want to take a closer look at the context from your example because it is more common in WordPress to do this within a theme than within a function, as is the case here. From the tutorial:

You still need to display the meta box’s HTML though. That’s where the
smashing_post_class_meta_box() function comes in ($callback parameter
from above).

Then the code example you posted is displayed and further explained:

What the above function does is display the HTML output for your meta
box. It displays a hidden nonce input. It then displays an input element for adding
a custom post class as well as output the custom class if one has been
input.

Ok, that’s great, but to understand why we are able to write HTML this way in our function we need to go back to the previous step in the tutorial where we actually add the meta box:

/* Create one or more meta boxes to be displayed on the post editor screen. */
function smashing_add_post_meta_boxes() {

  add_meta_box(
    'smashing-post-class',      // Unique ID
    esc_html__( 'Post Class', 'example' ),    // Title
    'smashing_post_class_meta_box',   // Callback function
    'post',         // Admin page (or post type)
    'side',         // Context
    'default'         // Priority
  );
}

You can see here that when adding the meta box, we have the callback function from your question named smashing_post_class_meta_box. It is only because the function smashing_post_class_meta_box is hooked to this specific meta box that the HTML is parsed here. If you just ran the function smashing_post_class_meta_box randomly, it would not be displayed at all as it would likely be running prior to WordPress init.