Bird
0
0

Which statement about static properties and methods in PHP is TRUE?

hard📝 Conceptual Q10 of 15
PHP - Classes and Objects
Which statement about static properties and methods in PHP is TRUE?
AStatic properties can be accessed only through object instances
BStatic methods can access static properties using self::
CStatic methods can use $this to refer to the current object
DStatic properties are unique to each object instance
Step-by-Step Solution
Solution:
  1. Step 1: Recall static method and property access rules

    Static methods access static properties with self::.
  2. Step 2: Eliminate incorrect options

    Static properties are accessed via class, not objects; static methods cannot use $this.
  3. Final Answer:

    Static methods can access static properties using self:: -> Option B
  4. Quick Check:

    Static method access static property = self:: [OK]
Quick Trick: Static methods use self::, no $this inside static context [OK]
Common Mistakes:
  • Using $this inside static methods
  • Accessing static properties via object instances
  • Thinking static properties are per object

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes