From the course: Learning PHP

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Namespacing

Namespacing - PHP Tutorial

From the course: Learning PHP

Start my 1-month free trial

Namespacing

- [Illustrator] When you declare a variable, you can reassign values to it over and over again, even within the same scope. But when it comes to functions and classes, PHP isn't so open to that, and for good reason. Changing how a function works in the middle of a program would be like replacing your car engine with a bike pedals in the middle of the Daytona 500. That also means you need to be mindful of the code already written, especially if you're working within a larger framework with lots of contributing developers, something like WordPress or Laravel. You might not know all of the code that's written or could be written, and if your class or function names are not specific enough, you could unknowingly cause a site breaking errors. A more recent development in writing PHP is Namespacing. The idea here is that you might not have a class of functions, but it's common functionality that you don't want colliding with…

Contents