summaryrefslogtreecommitdiff
path: root/documentation/tutorial.html
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-05 10:17:26 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-05 10:17:26 +0100
commited200cc18fb5fea88b8e9e2ff730af6cf1d50663 (patch)
treeaf2db9588d957d8cbdcb50cd7ce2d448eb4ef3a9 /documentation/tutorial.html
parent29ea3a29642f5cec612f102683e6d43aba226148 (diff)
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
Diffstat (limited to 'documentation/tutorial.html')
-rw-r--r--documentation/tutorial.html26
1 files changed, 13 insertions, 13 deletions
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 @@
<h2>How does PHP load its extensions?</h2>
<p>
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.
</p>
@@ -52,7 +52,7 @@
<h2>The get_module() startup function</h2>
<p>
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 @@
</pre></code>
</p>
<p>
- 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.
+</p>
<h2>Working with variables</h2>
<p>
Variables in PHP are non-typed. A variable can thus hold any possible type: