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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:53:34+00:00 2026-06-04T12:53:34+00:00

I am studying PHP,OOP and i am at Static, At this php.net/static i didnt

  • 0

I am studying PHP,OOP and i am at Static,
At this php.net/static i didnt understand this sentence

Calling non-static methods statically generates an E_STRICT level warning.

I did understand it’s Valid for methods only (not for Properties) by the sentence above,
but i didn’t succeed to understand It practically,
I’m glad if anything could please show me code that explains the sentence above,
Wishing you a pleasant week.

  • 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-04T12:53:35+00:00Added an answer on June 4, 2026 at 12:53 pm
    class Foo
    {
        public static $my_static = 'foo';
        public $my_non_static = 'bar';
    
        public function staticValue() {
            return self::$my_static;
        }
    
        public function nonStaticValue() {
            return self::$my_non_static;
        }
    }
    
    print Foo::$my_static . "\n"; // OK
    print Foo::staticValue(). "\n"; // E_STRICT
    
    print Foo::$my_non_static . "\n"; // Fatal
    print Foo::nonStaticValue(). "\n"; // Fatal
    

    print Foo::$my_static . "\n"; is OK – static property accessed statically.

    print Foo::staticValue(). "\n"; gives E_STRICT – non-static method accessed statically, but not Fatal error, because this method doesn’t access non-static properties.

    Other two give Fatal error because non-static field cannot be accessed statically.

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

Sidebar

Related Questions

I was studying Ray Tracing on http://www.devmaster.net/articles/raytracing_series/part1.php when I came across this piece of
I'm studying this code: http://www.w3style.co.uk/a-lightweight-and-flexible-front-controller-for-php-5 In it the author uses a static function to
I just saw this code while studying the wordpress source code (PHP), You can
I'm studying high-performance coding for websites in PHP, and this idea popped into my
I was studying Perlin's Noise through some examples @ http://dindinx.net/OpenGL/index.php?menu=exemples&submenu=shaders and couldn't help to
I am studying OOP and this is my first study project. I created a
I am studying for the PHP 5 Certification exam. This function was mentioned in
I am just studying other user's PHP code right now to understand and learn
I'm studying http://www.php.net/manual/en/function.dns-get-record.php and there seems to be no option to set a custom
Im studying for finals and i came across this question: write a PHP script

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.