diff options
author | Shawn Zhang <shawnzhang009@gmail.com> | 2016-03-15 11:42:20 +0800 |
---|---|---|
committer | Shawn Zhang <shawnzhang009@gmail.com> | 2016-03-15 11:42:20 +0800 |
commit | b38a7645366b1580b5f554303e411447c7d2d09d (patch) | |
tree | cfe5c9e59fa1f3611a5b5545f9b2d74cbac461f2 /php.html.markdown | |
parent | 072424afd77b9d772102f83508fcc337ffc81a7d (diff) | |
parent | fbe11b52d5fe839f791935012b93ff8ef2ac91f6 (diff) |
Merge remote-tracking branch 'upstream/master'
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 |