mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 18:11:38 +00:00
Merge pull request #1268 from jklein/patch-1
All class constants can be accessed statically
This commit is contained in:
commit
70af92f5c0
@ -495,7 +495,9 @@ class MyClass
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Class constants can always be accessed statically
|
||||||
echo MyClass::MY_CONST; // Outputs 'value';
|
echo MyClass::MY_CONST; // Outputs 'value';
|
||||||
|
|
||||||
echo MyClass::$staticVar; // Outputs 'static';
|
echo MyClass::$staticVar; // Outputs 'static';
|
||||||
MyClass::myStaticMethod(); // Outputs 'I am static';
|
MyClass::myStaticMethod(); // Outputs 'I am static';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user