summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-09-12 05:46:02 -0700
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-09-12 05:46:02 -0700
commit9634a336f080bc15c1e67495eb9216d1863808f8 (patch)
tree139d3abc65f156d5e72e02364481fea370c807dc /tests
parent68fd128d82819db1022137a45ca3224cee8ef029 (diff)
It now is possible to access global variables, using environment[varname], and to set global variable using environment[varname] = "value"
Diffstat (limited to 'tests')
-rw-r--r--tests/simple/simple.cpp10
-rw-r--r--tests/simple/simple.php7
2 files changed, 15 insertions, 2 deletions
diff --git a/tests/simple/simple.cpp b/tests/simple/simple.cpp
index 2ab177f..dede458 100644
--- a/tests/simple/simple.cpp
+++ b/tests/simple/simple.cpp
@@ -15,10 +15,18 @@
*/
using namespace std;
-static Php::Value my_plus(Php::Parameters &params)
+static Php::Value my_plus(Php::Environment &env, Php::Parameters &params)
{
string p1 = params[0];
string p2 = params[1];
+
+ cout << "global g1: " << env["g1"].stringValue() << endl;
+ cout << "global g2: " << env["g2"].stringValue() << endl;
+
+ Php::Global g(env["g3"]);
+
+ g = "zo kan het ook";
+
return p1 + p2;
}
diff --git a/tests/simple/simple.php b/tests/simple/simple.php
index 6f70a7a..af9a2a2 100644
--- a/tests/simple/simple.php
+++ b/tests/simple/simple.php
@@ -18,11 +18,16 @@ class MyClass {
}
}
+$g1 = 123;
+$g2 = "abc";
+
$result = my_plus(new MyClass(), array(), new MyClass(), $myvar, "blabla", new XXX());
echo("myvar = $myvar\n");
echo("resultaat: $result\n");
-print_r($result);
+echo("g1: $g1\n");
+echo("g2: $g2\n");
+echo("g3: $g3\n");