From bf4cc9a5e2c0a19f2099414b0a476402360fd9f8 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Mon, 2 Sep 2013 00:00:22 +0200 Subject: Update README.md --- README.md | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index f4b73a9..d468b07 100644 --- a/README.md +++ b/README.md @@ -7,42 +7,32 @@ extensions for PHP. Unlike regular PHP extensions - which are really hard to implement and require a deep knowledge of the Zend engine and pointer manipulation - extensions built with PHP-CPP -are not difficult to developer at all. In fact, the only thing you need to do is write a function in +are not difficult to develop at all. In fact, the only thing you need to do is write a function in C++, and the PHP-CPP library uses all the power offered by C++11 to convert the parameters and return values from your functions to/and from PHP: -
-/**
- *  Hello world function
- *  @return std::string
- */
+
 std::string hello_word()
 {
     return std::string("hello world!");
 }
-
+
The function above is a native C++ function. With PHP-CPP you can export this function to PHP with only one single C++ method call: -
+
 extension.function("hello_world", hello_world);
-
+
Working with parameters and return values is just as easy: -
-/**
- *  Function that takes parameters
- *  @param  int
- *  @param  int
- *  @return int
- */
+
 int my_plus(int a, int b)
 {
     return a+b;
 }
-
+
The PHP-CPP library ensures that the variables from PHP (which internally are complicated C structures), are automatically converted into @@ -57,11 +47,7 @@ The return value of your function is also transformed by PHP-CPP into PHP. More complicated structured can be handled by PHP-CPP as well. If you would like to return a nested associative array from your function, you can do so too: -
-/**
- *  A C++ function that returns a nested PHP array
- *  @return array
- */
+
 PhpCpp::Value get_complex_array()
 {
     PhpCpp::Value r;
@@ -71,15 +57,11 @@ PhpCpp::Value get_complex_array()
     r["c"][1] = "example";
     return r;
 }
-
+
The C++ function above is equivalent to the following function in PHP: - -/** - * PHP alternative - * @return array - */ +
 function get_complex_array()
 {
     return array(
@@ -88,7 +70,7 @@ function get_complex_array()
         "c" => array("nested_value","example")
     );
 }
-
+ However, this library is currently a work in progress, and it is an open source project. We are looking for people who'd like to contribute to it. -- cgit v1.2.3