summaryrefslogtreecommitdiffhomepage
path: root/php.html.markdown
diff options
context:
space:
mode:
authorven <vendethiel@hotmail.fr>2016-03-11 09:38:04 +0100
committerven <vendethiel@hotmail.fr>2016-03-11 09:38:04 +0100
commit5d23c9ec278ba9911c28f14bb200613f2586fa40 (patch)
treed210901ab958053a5e44f36b9c74f87e23c7e28f /php.html.markdown
parent60be912428d8776d758b0ff050c17be9d8eb6b3e (diff)
parentd9f3b13e278eebb173253c756ffe847b3188f4af (diff)
Merge pull request #1583 from AkshayKalose/patch-4
Add More Magic Methods in PHP
Diffstat (limited to 'php.html.markdown')
-rw-r--r--php.html.markdown15
1 files changed, 14 insertions, 1 deletions
diff --git a/php.html.markdown b/php.html.markdown
index 6944390c..6c2b38c8 100644
--- a/php.html.markdown
+++ b/php.html.markdown
@@ -539,10 +539,23 @@ class MyClass
print 'MyClass';
}
- //final keyword would make a function unoverridable
+ // final keyword would make a function unoverridable
final function youCannotOverrideMe()
{
}
+
+ // Magic Methods
+
+ // what to do if Object is treated as a String
+ public function __toString() {
+ return $property;
+ }
+
+ // opposite to __construct()
+ // called when object is no longer referenced
+ public function __destruct() {
+ print "Destroying";
+ }
/*
* Declaring class properties or methods as static makes them accessible without