diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-11 16:25:15 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-11 16:25:15 +0100 |
commit | 772c073816d18a7593c5c20043f27bb935379ebb (patch) | |
tree | 45d421fdb9c61a6b7b89ec73e7ffb62147ee033d /documentation | |
parent | 849c1c4cd7901213e54af954646a80137ad95619 (diff) |
update documentation
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/magic-methods.html | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/documentation/magic-methods.html b/documentation/magic-methods.html index a12809a..d6a7c21 100644 --- a/documentation/magic-methods.html +++ b/documentation/magic-methods.html @@ -208,7 +208,7 @@ unset($user->email); __invoke() method. This is a method that gets called when an object instance is used <i>as if</i> it was a function. This can be compared with overloading the operator () in a C++ class. By implementing the __invoke() method, scripts - from PHP user space can create a method, and then use it as a function. + from PHP user space can create an object, and then use it as a function. <p> <pre class="language-c++"><code> #include <phpcpp.h> @@ -316,9 +316,17 @@ extern "C" { <?php // initialize an object $object = new MyClass(); + +// call a regular method +echo($object->regular()."\n"); + +// call some pseudo-methods echo($object->something()."\n"); echo($object->myMethod(1,2,3,4)."\n"); echo($object->whatever("a","b")."\n"); + +// call the object as if it was a function +echo($object("parameter","passed","to","invoke")."\n"); ?> </code></pre> </p> |