summaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-04 09:27:01 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-04 09:27:01 +0100
commit59cfe935248918c1151b300eb19496b76ed579a9 (patch)
treee4f00380d599fe3f7cc9399edead14ca1b74a6f9 /Examples
parentecc297108d2851af885c1fb28434769f9478649d (diff)
removed forcedvalue and implemented array and object directly because now it is easier to finetune these classes, removed the Value::validate() method because it does not seem to be necessary, Object constructor now also accepts Php::Value objects that hold a string, to instantiate the described class
Diffstat (limited to 'Examples')
-rw-r--r--Examples/CppClassesInPhp/cppclassinphp.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/Examples/CppClassesInPhp/cppclassinphp.cpp b/Examples/CppClassesInPhp/cppclassinphp.cpp
index 2d17e19..95f909b 100644
--- a/Examples/CppClassesInPhp/cppclassinphp.cpp
+++ b/Examples/CppClassesInPhp/cppclassinphp.cpp
@@ -50,9 +50,22 @@ public:
if (params.size() != 1) throw Php::Exception("Invalid number of parameters supplied");
std::cout << "myMethod is called." << std::endl;
+
+ // create a new PHP DateTime object representing the current time
+ Php::Object now("DateTime", "now");
+
+ // show it
+ std::cout << "current time: " << now.call("format", "Y-m-d H:i:s") << std::endl;
+ std::cout << "construct " << params[0] << std::endl;
+
// construct a new class
- return Php::Object(params[0]);
+ Php::Object obj(params[0]);
+
+ std::cout << "return " << params[0] << std::endl;
+
+ // return it
+ return obj;
// std::cout << "get property1 " << value()["property1"] << std::endl;