diff options
Diffstat (limited to 'static-constant_members.php')
-rw-r--r-- | static-constant_members.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/static-constant_members.php b/static-constant_members.php new file mode 100644 index 0000000..9f2debe --- /dev/null +++ b/static-constant_members.php @@ -0,0 +1,16 @@ +<?php + +class Base { + const MODELNUMBER = 0xdeadbeef; /* no 'public' keyword */ + public static $REVISION = 0x2; + public $foo = 0; + + function __costruct() { + /* useful naming convention in the longrun if times comes to rename */ + } +} + +$d1 = new Base(); + +print "<h2>" . Base::MODELNUMBER . Base::$REVISION . "</h2>" . PHP_EOL; +print "<h2>" . $d1::MODELNUMBER . $d1::$REVISION . "</h2>" . PHP_EOL; /* -> operator can't access static&const members */ |