aboutsummaryrefslogtreecommitdiff
path: root/Examples/php/pointer
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/php/pointer')
-rw-r--r--Examples/php/pointer/example.i9
-rw-r--r--Examples/php/pointer/runme.php14
2 files changed, 8 insertions, 15 deletions
diff --git a/Examples/php/pointer/example.i b/Examples/php/pointer/example.i
index 1f0059406..31d2a03e0 100644
--- a/Examples/php/pointer/example.i
+++ b/Examples/php/pointer/example.i
@@ -21,10 +21,5 @@ extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
/* Next we'll use typemaps and the %apply directive */
-//%apply int *OUTPUT { int *r };
-//extern int divide(int n, int d, int *r);
-
-
-
-
-
+%apply int *OUTPUT { int *r };
+extern int divide(int n, int d, int *r);
diff --git a/Examples/php/pointer/runme.php b/Examples/php/pointer/runme.php
index e79b23810..8dc3ab887 100644
--- a/Examples/php/pointer/runme.php
+++ b/Examples/php/pointer/runme.php
@@ -1,7 +1,5 @@
<?php
- require "example.php";
-
# First create some objects using the pointer library.
print "Testing the pointer library\n";
@@ -14,7 +12,7 @@
print " b = $b\n";
print " c = $c\n";
- # Call the add() function wuth some pointers
+ # Call the add() function with some pointers
add($a,$b,$c);
print " $a + $b = $c\n";
@@ -28,8 +26,8 @@
print " 37 - 42 = $r\n";
# Now try the version with multiple return values
- # print "Testing multiple return values\n";
- # ($q,$r) = divide(42,37);
- # print " 42/37 = $q remainder $r\n";
-
-?>
+ print "Testing multiple return values\n";
+ $a = divide(42,37);
+ $q = $a[0];
+ $r = $a[1];
+ print " 42/37 = $q remainder $r\n";