What’s the benefit of namespaces in PHP? I’ve worked on multiple MVC systems and haven’t found much use for them. I’m reading about them here…. is it a problem of sorts that I’ve never used them? Is it the kind of thing that is a good coding standard to always use?
Share
Like any other languages, namespaces allow ambigious names / classes with same name to co-exists while being in two different namespaces.
For example
Tableclass can be referring to a table in a persistent database and a HTML table. I can put namespaces to specifically use the exact table that I want, i.e.\Model\Tableand\View\Tablerespectively.