From 772c073816d18a7593c5c20043f27bb935379ebb Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Tue, 11 Mar 2014 16:25:15 +0100 Subject: update documentation --- documentation/magic-methods.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'documentation') 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 as if 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.


 #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");
 ?>
 

-- cgit v1.2.3