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 8286113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:37:56+00:00 2026-06-08T11:37:56+00:00

The PSR-0 ( https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md ) standard specifies that an underscore in the class name

  • 0

The PSR-0 (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) standard specifies that an underscore in the class name should be converted to a directory separator in the corresponding file name.

To me this does not seem to be a good idea as it creates lots of errors when someone who does not know the standard innocently uses an underscore in the class name and suddenly the autoloader cannot find the class and all sort of weird errors appear (see this stackoverflow issue for example: Symfony2.1 mapping error: class_parents())

So I guess there must be some kind of reason (historical compatibility with some library?) for this “feature”. My question is: does anyone know why this was introduced in the PSR-0 standard?

  • 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-08T11:37:58+00:00Added an answer on June 8, 2026 at 11:37 am

    Underscores were used in the times that PHP didn’t yet support namespaces. A “correct” organized project follows the convention of namespacing the files the same way as the directory structure.

    It is just some general “rule” to organize files in a project.

    So if you have a directory structure of:

    root
      Name
        Package
          MyClass.php
    

    People used to do:

    class Name_Package_MyClass {}
    

    But now that we have namespaces it becomes:

    namespace Name\Package;
    
    class MyClass { }
    

    It is just coding style guideline which ensures that everybody does the same thing.

    So what PSR-0 does is map both the old and the new style of namespacing to a filename.

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

Sidebar

Related Questions

is anyone aware of lightweight restful lib that is namespaced following psr-0 guide lines.
I am looking for a form class that: Is standalone/doesnt need a framework to
I have VBA code that takes my data on the master worksheet and puts
I´v a problem on the site PSR how can I make it that the
What's the PSR-2 Standard coding convention for initialization of arrays and method chaining? $foo
I have a table given below PSR exon 3311421 E11 3311422 E11 3311423 E11
I'm currently attempting to write my own program that mirrors the pmap command, specifically
I am looking for a (small) library that helps me cleanly implement a front
I have a combo box that contains 5 items. I have one label on
I understand that a bundle should contain the directory structure and other conventions outlined

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.