From 55cfec6918fca9d3790ec8ab231d0178349fe2fa Mon Sep 17 00:00:00 2001 From: Kyle Kaminski <kyle@xenomedia.com> Date: Tue, 8 Apr 2014 01:32:25 -0500 Subject: static&constant members class example --- static-constant_members.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 static-constant_members.php (limited to 'static-constant_members.php') 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 */ -- cgit v1.2.3