Skip to content

Instantly share code, notes, and snippets.

@rubensayshi
Created March 20, 2015 18:41
Show Gist options
  • Select an option

  • Save rubensayshi/be74404020e666247e07 to your computer and use it in GitHub Desktop.

Select an option

Save rubensayshi/be74404020e666247e07 to your computer and use it in GitHub Desktop.
$a = "old";
$b = $a:
myext_fn($a); // modifies $a by ref
$b == $a == $compressed; // true, $b shouldn't be changed
PHP_FUNCTION(myext_fn) {
zval **a;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &a) == FAILURE) {
return;
}
ZVAL_STRINGL(*a, "new", 4);
}
PHP_FUNCTION(myext_fn) {
zval *a;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a) == FAILURE) {
return;
}
ZVAL_STRINGL(a, "new", 4);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment