summaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
authorJasperVanEck <jaspergkurtz@gmail.com>2013-11-29 13:02:30 +0100
committerJasperVanEck <jaspergkurtz@gmail.com>2013-11-29 13:02:30 +0100
commit503651a6fe27b5925d77b1c5712a620be35a5718 (patch)
treefa256baaafddbdf06fa3c67fdecda48c319f95f8 /Examples
parent71aa5265c41ae9d812d0e73b4deaa1c760985316 (diff)
Comment update
Diffstat (limited to 'Examples')
-rw-r--r--Examples/Exceptions/exception.php22
-rw-r--r--Examples/FunctionNoParameters/functionnoparameters.php8
-rw-r--r--Examples/FunctionReturnValue/functionreturnvalue.php5
3 files changed, 16 insertions, 19 deletions
diff --git a/Examples/Exceptions/exception.php b/Examples/Exceptions/exception.php
index 9c02286..81bbd50 100644
--- a/Examples/Exceptions/exception.php
+++ b/Examples/Exceptions/exception.php
@@ -1,25 +1,25 @@
<?php
-/*
+/**
* exception.cpp
- * @author Jasper van Eck<jasper.vaneck@copernica.com>
*
- * An example file to show the working of a function which throws an exception.
+ * @author Jasper van Eck <jasper.vaneck@copernica.com>
+ *
+ * This example shows the working of a C++ function that throws an
+ * exception, and that exception is then caught by PHP code.
*
- * Exceptions haven't been implemented yet.
- * Therefore this example is not yet a working one.
- */
-
-/*
- * Run a function which throws an exception.
*/
+// try-catch block to be able to handle the exception
try
{
- echo "Function which throws an exception; my_throw_exception_function()\n";
- echo my_throw_exception_function() . "\n";
+ // the my_throw_exception function is implemented in C++. and
+ // it is going to throw an exception
+ my_throw_exception_function();
}
catch (Exception $exception)
{
+ // the exception object is thrown by C++ code, and caught by PHP
+ // code
echo $exception->getMessage(). "\n";
}
diff --git a/Examples/FunctionNoParameters/functionnoparameters.php b/Examples/FunctionNoParameters/functionnoparameters.php
index efaafc3..f4035ae 100644
--- a/Examples/FunctionNoParameters/functionnoparameters.php
+++ b/Examples/FunctionNoParameters/functionnoparameters.php
@@ -1,13 +1,11 @@
<?php
-/*
+/**
* functionnoparameters.php
* @author Jasper van Eck<jasper.vaneck@copernica.com>
*
* An example file to show the working of a function call without parameters.
*/
-/*
- * Run a function without parameters.
- */
-echo "A function which takes no parameters; my_no_parameters_function()\n";
+
+//Run a function without parameters.
echo my_no_parameters_function() . "\n";
diff --git a/Examples/FunctionReturnValue/functionreturnvalue.php b/Examples/FunctionReturnValue/functionreturnvalue.php
index ba8f52b..1626e19 100644
--- a/Examples/FunctionReturnValue/functionreturnvalue.php
+++ b/Examples/FunctionReturnValue/functionreturnvalue.php
@@ -1,13 +1,12 @@
<?php
-/*
+/**
* functionreturnvalue.php
* @author Jasper van Eck<jasper.vaneck@copernica.com>
*
* An example file to show the working of a function call with a return value.
*/
-/*
+/**
* Run a function which returns a value.
*/
-echo "Function which returns a value; my_return_value_function()\n"
echo my_return_value_function() . "\n";