diff options
Diffstat (limited to 'Examples')
4 files changed, 7 insertions, 7 deletions
diff --git a/Examples/CppClassesInPhp/cppclassinphp.cpp b/Examples/CppClassesInPhp/cppclassinphp.cpp index 2894fdc..a0871fc 100644 --- a/Examples/CppClassesInPhp/cppclassinphp.cpp +++ b/Examples/CppClassesInPhp/cppclassinphp.cpp @@ -56,7 +56,7 @@ extern "C" PHPCPP_EXPORT void *get_module() { // create extension - static Php::Extension extension("my_function_with_parameters","1.0"); + static Php::Extension extension("Cpp_classes_in_php","1.0"); // add the custom class ot the extension extension.add("MyClass", Php::Class<MyCustomClass>({ diff --git a/Examples/Exceptions/ExceptionCatch/exception.php b/Examples/Exceptions/ExceptionCatch/exception.php index 0fec704..f0bfe90 100644 --- a/Examples/Exceptions/ExceptionCatch/exception.php +++ b/Examples/Exceptions/ExceptionCatch/exception.php @@ -14,4 +14,4 @@ my_catch_exception_function(function($a, $b, $c) { // throw an exception from PHP - the C++ code will catch this exception throw new Exception("Example exception"); -});} +}); diff --git a/Examples/Exceptions/ExceptionCatch/exceptionCatch.cpp b/Examples/Exceptions/ExceptionCatch/exceptionCatch.cpp index a5f7b96..9efdf93 100644 --- a/Examples/Exceptions/ExceptionCatch/exceptionCatch.cpp +++ b/Examples/Exceptions/ExceptionCatch/exceptionCatch.cpp @@ -11,6 +11,7 @@ * Libraries used. */ #include <phpcpp.h> +#include <iostream> /** * Namespace to use @@ -39,7 +40,8 @@ void my_catch_exception_function(Php::Parameters ¶ms) } catch (Php::Exception &exception) { - // @todo handle the exception that was thrown from PHP space + // handle the exception that was thrown from PHP space + std::cout << "exception caught in CPP code" << std::endl; } } @@ -54,9 +56,7 @@ extern "C" static Php::Extension extension("my_exception_catch","1.0"); // add function to extension - extension.add("my_catch_exception_function", my_catch_exception_function, { - Php::ByVal("callback", Php::callableType); - }); + extension.add("my_catch_exception_function", my_catch_exception_function); // return the extension module return extension.module(); diff --git a/Examples/FunctionNoParameters/functionnoparameters.cpp b/Examples/FunctionNoParameters/functionnoparameters.cpp index 8934169..d41b681 100644 --- a/Examples/FunctionNoParameters/functionnoparameters.cpp +++ b/Examples/FunctionNoParameters/functionnoparameters.cpp @@ -32,7 +32,7 @@ extern "C" PHPCPP_EXPORT void *get_module() { // create extension - static Php::Extension extension("my_function_return_value","1.0"); + static Php::Extension extension("my_function_no_parameters","1.0"); // add function to extension extension.add("my_no_parameters_function", my_no_parameters_function); |