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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:59:28+00:00 2026-06-11T11:59:28+00:00

As of php 5.3, the static keyword resolved the late static binding issue and

  • 0

As of php 5.3, the static keyword resolved the late static binding issue and it can be used like most other OO languages use self. In PHP self still exists.

I know how the two keywords are separate functionally as previously pointed out in this question: Is there any reason to use the self keyword?.

However, my question is: Can anyone give a reason why you would want to use self in code meant to run only with 5.3 or later PHP? Does self have better performance? I’ve yet to find any compelling use case for using the self keyword anymore. My understanding is it only remains to allow old libraries to continue working in an expected manner.

The key to the question is can anyone suggest a good reason, ANY GOOD REASON, just one, tiny, little, reason that makes sense for a competent PHP developer to say “Gee, here I should really use ‘self’ instead of ‘static’.”

Because you might want to shoot yourself in the foot and that’s a reason to use it isn’t a good reason.

  • 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-11T11:59:29+00:00Added an answer on June 11, 2026 at 11:59 am

    Ah! Found my one good reason. At the moment in php 5.3 you cannot access compile time constants with static.

    The code below will throw an error

     class Foo{
          const BAR = "FREE BEER";
    
          public static function whatDoWeLove(){
              return static::BAR;
          }
     }
    
    
     echo Foo::whatDoWeLove();
    

    The error I get is:

    PHP Fatal error:  "static::" is not allowed in compile-time constants in....
    

    So, I guess for now self limps along until that changes or PHP adds the ability to use the final keyword with static properties. Drats.

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

Sidebar

Related Questions

PHP classes can use the keyword self in a static context, like this: <?php
With the new static keyword in PHP 5, is there any reason to use
I was working on some PHP around the static:: keyword, and encountered an issue
In PHP, call_user_func(array(self, 'method_name')) doesn't work. The self keyword cannot be used in that
Using PHP, I can convert MySQL data or static table data to csv, Excel,
I am trying to use a PHP function from within a public static function
How can I access a static variable in a separate class in PHP? Is
It seems that the uaa() function can be used as a static function even
How can I access static php variable with custom class name. In class c1
I've noticed that the keyword static in PHP is not that static at all.

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.