From ed200cc18fb5fea88b8e9e2ff730af6cf1d50663 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Wed, 5 Mar 2014 10:17:26 +0100 Subject: fixed some compiler warnings in value.cpp, added documentation on how to install PHP-CPP, removed the Makefile from the src directory and moved everything into the single Makefile in the library root directory, also updated the main (and now only) Makefile with instructions so that it is easier for others to understand --- documentation/tutorial.html | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'documentation/tutorial.html') diff --git a/documentation/tutorial.html b/documentation/tutorial.html index 30d8ea7..ff2bbbc 100644 --- a/documentation/tutorial.html +++ b/documentation/tutorial.html @@ -13,9 +13,9 @@

How does PHP load its extensions?

You probably already know that native PHP extensions are compiled into *.so - files on unix-like systems, and *.dll files on Windows environments, and that + files on unix-like systems, and *.dll files in Windows environments, and that the global php.ini file holds a list of all extensions available on your system. - This means that if you're building your own extension, you will also need to + This means that if you're building your own extension, you are also going to create such a *.so or *.dll file and you will need to update the PHP configuration so that your own extension is loaded by PHP.

@@ -52,7 +52,7 @@

The get_module() startup function

Before we explain how you can create your own extension however, we first explain - what PHP does to load an extension. When PHP starts, it loads the configuration + what PHP does to load an extension. When PHP starts, it loads the *.ini configuration file(s) that we just described and for each "extension=name.so" line in these files, it opens the appropriate library, and calls the "get_module()" function from it. Each extension library (your extension too) must therefore @@ -214,7 +214,7 @@ PHPCPP_EXPORT void *get_module() { static Php::Extension myExtension("my_extension", "1.0"); myExtension.add("example", example, { - Php::ByVal("a", Php::numericType), + Php::ByVal("a", Php::Type::Numeric), Php::ByVal("b", "ExampleClass"), Php::ByRef("c", "OtherClass") }); @@ -224,15 +224,15 @@

- Above you see that we pass in additional information when we register the - - - - The Extension::add() method can be used to register native functions, and - make them available in PHP. In the examples above, you've seen that the - method takes two parameters: the name the function shou - - + Above you see that we passed in additional information when we registered the + "example" function. We tell our extension that our function accepts three parameters: + the first parameter must be a regular number, while the other ones are object + instances of type "ExampleClass" and "OtherClass". In the end, your native C++ + "example" function will still be called with a Php::Parameters instance, but + the moment it gets called, you can be sure that the Php::Parameters object + will be filled with three members, and that two of them are objects of the + appropriate type, and that the third one is also passed by reference. +

Working with variables

Variables in PHP are non-typed. A variable can thus hold any possible type: -- cgit v1.2.3