From: Derick Rethans Date: Sat, 15 Dec 2001 14:45:59 +0000 (+0000) Subject: - Added a second parameter to var_export which makes the function return X-Git-Tag: PRE_ISSET_PATCH~537 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=143df7de6b015c9c7811ee2bed522da56bab807d;p=php - Added a second parameter to var_export which makes the function return the variable representation in a string. --- diff --git a/ext/standard/var.c b/ext/standard/var.c index 56e7e9bc96..0f9a41e25e 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -202,26 +202,27 @@ head_done: /* }}} */ -/* {{{ proto void var_export(mixed var) - Dumps a string representation of variable to output */ +/* {{{ proto mixed var_export(mixed var [, int return]) + Outputs or returns a string representation of avariable */ PHP_FUNCTION(var_export) { - zval ***args; - int argc; - int i; + zval *var; + long i = 0; - argc = ZEND_NUM_ARGS(); - - args = (zval ***)emalloc(argc * sizeof(zval **)); - if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_array_ex(argc, args) == FAILURE) { - efree(args); - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &var, &i) == FAILURE) { + return; } - for (i=0; i