summaryrefslogtreecommitdiff
path: root/documentation/magic-methods.html
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-11 14:31:26 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-11 14:31:26 +0100
commit75321da61984251d6f5ab97f57efb2050f4dadf2 (patch)
tree2df23fc111a7e572f7bd81becb3a211d6af6777e /documentation/magic-methods.html
parentc659c37e4db9c96f01f7e540135e392174a34cb3 (diff)
update __call example
Diffstat (limited to 'documentation/magic-methods.html')
-rw-r--r--documentation/magic-methods.html31
1 files changed, 25 insertions, 6 deletions
diff --git a/documentation/magic-methods.html b/documentation/magic-methods.html
index a3fa4de..0f2067f 100644
--- a/documentation/magic-methods.html
+++ b/documentation/magic-methods.html
@@ -224,7 +224,18 @@ public:
*/
Php::Value __call(const char *name, Php::Parameters &amp;params)
{
- return std::string("method: ")+name;
+ // the return value
+ std::string retval = name;
+
+ // loop through the parameters
+ for (auto &amp;param : params)
+ {
+ // append parameter string value to return value
+ retval += " " + param.stringValue();
+ }
+
+ // done
+ return retval;
}
};
@@ -257,16 +268,24 @@ extern "C" {
</code></pre>
</p>
<p>
- The following PHP script calls some method on this class.
-</p>
-<p>
<pre code="language-php"><code>
&lt;?php
// initialize an object
$object = new MyClass();
echo($object->something()."\n");
-echo($object->myMethod()."\n");
-echo($object->whatever()."\n");
+echo($object->myMethod(1,2,3,4)."\n");
+echo($object->whatever("a","b")."\n");
?&gt;
</code></pre>
</p>
+<p>
+ The above PHP script calls some method on this class. And will generate
+ the following output:
+</p>
+<p>
+<pre>
+something
+myMethod 1 2 3 4
+whatever a b
+</pre>
+</p>