-
-
Save michaelhood/5074420 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This is largely stolen from test.php in the Inline_C repo (https://github.com/pear/Inline_C/blob/master/test.php) | |
require_once("C.php"); | |
$function1 = <<<EOF | |
PHP_FUNCTION(times) | |
{ | |
long i,j; | |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &i,&j) == FAILURE) { | |
WRONG_PARAM_COUNT; | |
} | |
RETURN_LONG(i*j); | |
} | |
EOF; | |
$inline = new Inline_C(); | |
$inline->add_code($function1); | |
$inline->compile(); | |
echo "2 x 3 is " . times(2,3); // returns 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment