How namespace should be used in the following scenario?

A function called ‘AddUser()’ is defined in the global namespace called ‘user’.
You have to use it in the namespace called ‘sales’.

What is the correct method to import namespace, hence you can call the AddUser() function?

Train Asked on January 7, 2016 in PHP.
Add Comment
  • 1 Answer(s)

    Since you are in the same root, The namespace ‘user’ can be used as,

    use \user;
     

    so you can directly call AddUser()

    Train Answered on January 7, 2016.
    Add Comment

    Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.