Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7936029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:05:23+00:00 2026-06-03T22:05:23+00:00

I am having a little trouble with namespaces and the use statements. I have

  • 0

I am having a little trouble with namespaces and the use statements.

I have three files: ShapeInterface.php, Shape.php and Circle.php.

I am trying to do this using relative paths so I have put this in all of the classes:

namespace Shape; 

In my circle class I have the following:

namespace Shape;
//use Shape;
//use ShapeInterface;

include 'Shape.php';
include 'ShapeInterface.php';    

class Circle extends Shape implements ShapeInterface{ ....

If I use the include statements I get no errors. If I try the use statements I get:

Fatal error: Class ‘Shape\Shape’ not found in
/Users/shawn/Documents/work/sites/workspace/shape/Circle.php on line 8

Could someone please give me a little guidance on the issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:05:24+00:00Added an answer on June 3, 2026 at 10:05 pm

    The use operator is for giving aliases to names of classes, interfaces or other namespaces. Most use statements refer to a namespace or class that you’d like to shorten:

    use My\Full\Namespace;
    

    is equivalent to:

    use My\Full\Namespace as Namespace;
    // Namespace\Foo is now shorthand for My\Full\Namespace\Foo
    

    If the use operator is used with a class or interface name, it has the following uses:

    // after this, "new DifferentName();" would instantiate a My\Full\Classname
    use My\Full\Classname as DifferentName;
    
    // global class - making "new ArrayObject()" and "new \ArrayObject()" equivalent
    use ArrayObject;
    

    The use operator is not to be confused with autoloading. A class is autoloaded (negating the need for include) by registering an autoloader (e.g. with spl_autoload_register). You might want to read PSR-4 to see a suitable autoloader implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a little trouble trying to accomplish this. Here is the gist
I am having a little trouble getting this to work. I have several anchor
I'm having a little trouble with something. I have an HttpGet method like this:
Im having a little trouble with a php script ive made. you can see
Question: I'm having a little trouble with jQuery: Consider this HTML, where I want
I am having a little trouble understanding ServiceKnownType in WCF. Taken from this blog
Im having a little trouble with running a php script in the background. I
I'm having a little trouble with my insert statement this morning. Yes, I am
Im having a little trouble setting up routes. I have a 'users' controller/model/views set
I'm having a little trouble defining my question. Here's what I have. A mailto

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.