2
<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

How come this code from web.php that is given to me as a part of the framework does not have the ?> enclosure at the end as all .php files should? Sorry but I am new to php and Laravel and just trying to write some example routes from a textbook.

mLstudent33
  • 1,033
  • 3
  • 14
  • 32
  • 1
    If you close the tag any remaining text may be outputted as is, EOF (End of File) works just fine. I've never actually closed that tag before, does it still work if you do? – Josh Rumbut Aug 24 '18 at 02:15

1 Answers1

2

This prevents accidental whitespace or new lines being added after the PHP closing tag, which may cause unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script

Hussein
  • 1,143
  • 1
  • 9
  • 16