What is namespace in php?



What is namespace in php?..

Answer / Abhilasha Singh

In PHP, a namespace is a container for functions, classes, and interfaces to prevent naming conflicts. Namespaces provide a way to organize your code and keep it modular. Here's an example of how to use namespaces: n```phpnnns Foo; // This declares a namespace called Foonclass Bar {n}nFooBar $bar = new FooBar(); // Creates a new instance of the class Bar within the Foo namespacen```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

How to check an key is exists in array?

1 Answers  


Explain what does $_files means?

1 Answers  


Is php free to use?

1 Answers  


Where sessions stored in PHP?

1 Answers  


how to count how many sundays in month?

6 Answers   Photon, SR, TCS,


What is the difference between characters 34 and x34?

1 Answers  


How to get the number of characters in a string?

1 Answers  


Tell me which function gives us the number of affected entries by a query?

1 Answers  


What is the difference between "echo" and "print" in php?

1 Answers  


What is csrf token and how will you add csrf token in ajax?

1 Answers  


What are getters and setters php?

1 Answers  


Is php developer in demand?

1 Answers  


Categories