Created
April 25, 2016 16:23
-
-
Save abiusx/ad83a02125c120367a75e0027a324c67 to your computer and use it in GitHub Desktop.
An implementation of is_ref for PHP in C (for extensions)
This file contains hidden or 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
ZEND_BEGIN_ARG_INFO_EX(phpx_byref_arginfo, | |
1 /*pass_rest_by_reference*/, | |
0/*return_reference*/, | |
1/*required_num_args*/) | |
ZEND_ARG_PASS_INFO(1/*by_ref*/) | |
ZEND_END_ARG_INFO(); | |
PHP_FUNCTION(is_ref) | |
{ | |
zval *z; | |
int res; | |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,"z",&z)==FAILURE) | |
return; | |
RETURN_BOOL(Z_REFCOUNT_P(z) > 2); | |
//1 is the reference sent to this function, the other is the actual var. | |
//if more, reference! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment