E.g. via
<?php
class Foo {
public function bar() {
echo '-> '. self::$data . ' <-';
}
public static $data="FooData";
}
$foo = new Foo;
$foo->bar();
More Related Contents:
- Why does PHP 5.2+ disallow abstract static class methods?
- Is it possible to create static classes in PHP (like in C#)?
- When do I use static variables/functions in php?
- Getting static property from a class with dynamic class name in PHP
- How do I access static member of a class?
- remove duplicate key array from php [duplicate]
- When should I use ‘self’ over ‘$this’?
- Is there a use-case for singletons with database access in PHP?
- What does the variable $this mean in PHP?
- What is the best method to merge two PHP objects?
- What is the point of interfaces in PHP?
- Best practice on PHP singleton classes [duplicate]
- PHP OOP core framework
- Multiple Inheritance in PHP
- Non-static method ….. should not be called statically
- When should I declare variables in a PHP class?
- If Singletons are bad then why is a Service Container good?
- When should I use stdClass and when should I use an array in php oo code?
- How to use class methods as callbacks
- Chaining Static Methods in PHP?
- Dynamically create PHP object based on string
- Nested or Inner Class in PHP
- Performance of static methods vs. functions
- Why is type hinting necessary in PHP?
- Fatal error: Uncaught ArgumentCountError: Too few arguments to function
- Does static method in PHP have any difference with non-static method?
- Cannot use concatenation when declaring default class properties in PHP?
- Interface implementation: declaration must be compatible
- How do I use a class method as a callback function?
- Expression is not allowed as field default value