summaryrefslogtreecommitdiff
path: root/main/output.c
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2000-08-25 03:10:42 +0000
committerStig Bakken <ssb@php.net>2000-08-25 03:10:42 +0000
commit03471b21ee419e00bdcafe1f3c9d7da254539a16 (patch)
tree6a22f5f36262268e6b507eb8d0c964968b3d72b8 /main/output.c
parent6cbdaf985fb9e06e493ca740f886a92663aaac57 (diff)
downloadphp-git-03471b21ee419e00bdcafe1f3c9d7da254539a16.tar.gz
@Added ob_get_length function (Stig)
Added ob_get_length() function (returns size of buffer)
Diffstat (limited to 'main/output.c')
-rw-r--r--main/output.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/main/output.c b/main/output.c
index 2b3fb8efe7..253b4294cf 100644
--- a/main/output.c
+++ b/main/output.c
@@ -269,6 +269,19 @@ int php_ob_get_buffer(pval *p)
}
+/* Return the size of the current output buffer */
+int php_ob_get_length(pval *p)
+{
+ OLS_FETCH();
+
+ if (OG(nesting_level) == 0) {
+ return FAILURE;
+ }
+ p->type = IS_LONG;
+ p->value.lval = OG(active_ob_buffer).text_length;
+ return SUCCESS;
+}
+
/*
* Wrapper functions - implementation
*/
@@ -383,6 +396,17 @@ PHP_FUNCTION(ob_get_contents)
/* }}} */
+/* {{{ proto string ob_get_length(void)
+ Return the length of the output buffer */
+PHP_FUNCTION(ob_get_length)
+{
+ if (php_ob_get_length(return_value)==FAILURE) {
+ RETURN_FALSE;
+ }
+}
+/* }}} */
+
+
/* {{{ proto void ob_implicit_flush([int flag])
Turn implicit flush on/off and is equivalent to calling flush() after every output call */
PHP_FUNCTION(ob_implicit_flush)