diff options
author | ven <vendethiel@hotmail.fr> | 2016-03-11 09:38:04 +0100 |
---|---|---|
committer | ven <vendethiel@hotmail.fr> | 2016-03-11 09:38:04 +0100 |
commit | 5d23c9ec278ba9911c28f14bb200613f2586fa40 (patch) | |
tree | d210901ab958053a5e44f36b9c74f87e23c7e28f /php.html.markdown | |
parent | 60be912428d8776d758b0ff050c17be9d8eb6b3e (diff) | |
parent | d9f3b13e278eebb173253c756ffe847b3188f4af (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.markdown | 15 |
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 |