summaryrefslogtreecommitdiffhomepage
path: root/php.html.markdown
diff options
context:
space:
mode:
authorAkshay Kalose <AkshayProductions@gmail.com>2015-10-16 22:07:08 -0400
committerAkshay Kalose <AkshayProductions@gmail.com>2015-10-16 22:07:08 -0400
commit64aa38a1d28d6e3b9f770e97476f0111f180bd3e (patch)
tree887dc07c2ec15b80ef5f2bb1b26621c554d076a5 /php.html.markdown
parent0e6d9f6fe9aeffc64c3adad3e4a0ee1cc0d1dd88 (diff)
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 39ec5aef..78d9d1f2 100644
--- a/php.html.markdown
+++ b/php.html.markdown
@@ -498,10 +498,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 no longer referenced
+ public function __destruct() {
+ print "Destroying"
+ }
/*
* Declaring class properties or methods as static makes them accessible without