- Laravel Version: 5.5.
- PHP Version: 7.0.0
exception: "SymfonyComponentDebugExceptionFatalThrowableError"
file: "/app/Http/Controllers/New/Folder/FlightController.php"
line: 3
message: "Parse error: syntax error, unexpected ‘New’ (T_NEW), expecting identifier (T_STRING)"
Getting parse/syntax error for using New
as the Folder name
app/Http/Controllers/New/Folder/FlightController.php
<?php
namespace appHttpControllersNewFolder; // This is error line as per complete Error message
use IlluminateHttpRequest;
use AppHttpControllersController;
use AppModelsFlight;
class FlightController extends Controller
{
2
Answers
Don’t use reserved words for variable/file/directory name. Programming 101.
Beside that you can have
New
as directory name if PHP8 is being used.