Owaiz Yusufi
Owaiz Yusufi

Reputation: 918

What is the use of namespace and am I using it is the right way?

I want to know that why the namespace is used what is the advantage and disadvantages of using it. If it is for just declaring constant then we can also use define() and constant or is it used for security reasons.

How can I use it if I have three files a, b and c respectively inside that function naming _a, _b and _c respectively?

Upvotes: 1

Views: 60

Answers (1)

Shashank Shekhar
Shashank Shekhar

Reputation: 150

namespace is used to solve a very common problem that is often found while using reusable code. You can use define and constant for defining but you will do it on same page. As u know words like controller class and many common words like this are used in nearly every language framework. And we use use integrated environment for our complex use. So these words may clash. using namespace ensures where we have to look first for the definitions of functions and words used below the namespace declaration.

Upvotes: 4

Related Questions