Created
January 3, 2015 06:24
-
-
Save sgolemon/f23dc4f90725bfedc611 to your computer and use it in GitHub Desktop.
HHVM vs PHP Extension APIs
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
<<__Native>> function foo(int $bar, string $baz): bool; | |
bool HHVM_FUNCTION(foo, int bar, const String& baz) { | |
// Do stuff with bar and baz | |
return true; | |
} | |
ZEND_BEGIN_ARG_INFO(foo_arginfo, 0, ZEND_RETURN_VALUE, 2) | |
ZEND_ARG_INFO(0, bar) | |
ZEND_ARG_INFO(0, baz) | |
ZEND_END_ARG_INFO(); | |
PHP_FUNCTION(foo) { | |
zend_long bar; | |
char *baz; | |
size_t baz_len; | |
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &bar, &baz, &baz_len) == FAILURE) { return; } | |
// Do something with bar and baz(_len) | |
RETURN_TRUE; | |
} | |
PHP_FE(foo, foo_arginfo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment