summaryrefslogtreecommitdiffstats
path: root/oo
diff options
context:
space:
mode:
authorKyle Kaminski <kyle@xenomedia.com>2014-04-09 22:08:27 -0500
committerKyle Kaminski <kyle@xenomedia.com>2014-04-09 22:08:27 -0500
commit02e716a67dd0e6987e732232ea48bc73f62eeb97 (patch)
tree4e79fc6176a5a0ad8c29e3976c84db88b24ab546 /oo
parentaf5272c6784050a97ce968d067274b86099fc3af (diff)
downloadphpsandbox-02e716a67dd0e6987e732232ea48bc73f62eeb97.tar.gz
phpsandbox-02e716a67dd0e6987e732232ea48bc73f62eeb97.tar.bz2
phpsandbox-02e716a67dd0e6987e732232ea48bc73f62eeb97.zip
interface example
Diffstat (limited to 'oo')
-rw-r--r--oo/interface.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/oo/interface.php b/oo/interface.php
new file mode 100644
index 0000000..3f6c3f7
--- /dev/null
+++ b/oo/interface.php
@@ -0,0 +1,24 @@
+<?php
+
+/* interface contains only fixed-name declarations/stubs in with no access levels, yet it allows public,
+ * no ctors, no data members, no method definitions, no restriction on who implements this interface
+ *
+ */
+interface iDB {
+ const MAX_RECORDS = 5000;
+ public function query();
+ public function drop();
+}
+
+class MyDBDriver implements iDB {
+ public function query() {
+ echo "querying" . PHP_EOL;
+ }
+ public function drop() {
+ echo "dropping" . PHP_EOL;
+ }
+}
+
+$db = new MyDBDriver();
+$db->query() . PHP_EOL;
+$db = NULL;