swig/Examples/php5/funcptr/runme.php
Olly Betts 1169874f59 [PHP] Add support for PHP7.
PHP5's C extension API has changed substantially so you need to use
-php7 to specify you want PHP7 compatible wrappers.
Fixes https://github.com/swig/swig/issues/571
2016-11-30 13:05:59 +13:00

24 lines
626 B
PHP

<?php
require "example.php";
$a = 37;
$b = 42;
# Now call our C function with a bunch of callbacks
print "Trying some C callback functions\n";
print " a = $a\n";
print " b = $b\n";
print " ADD(a,b) = ". do_op($a,$b,ADD)."\n";
print " SUB(a,b) = ". do_op($a,$b,SUB)."\n";
print " MUL(a,b) = ". do_op($a,$b,MUL)."\n";
print "Here is what the C callback function objects look like in php\n";
print "Using swig style string pointers as we need them registered as constants\n";
print " ADD = " . ADD . "\n";
print " SUB = " . SUB . "\n";
print " MUL = " . MUL . "\n";
?>