Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16258 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64567 invoked by uid 1010); 16 May 2005 18:23:00 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 42139 invoked by uid 1007); 16 May 2005 18:02:20 -0000 Message-ID: <20050516180220.42138.qmail@lists.php.net> To: internals@lists.php.net References: <20050513112935.50036.qmail@lists.php.net> <4288ACAB.8080709@caedmon.net> Date: Mon, 16 May 2005 11:02:30 -0700 Lines: 62 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1478 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478 X-Posted-By: 169.229.139.92 Subject: Re: [PHP-DEV] Function proposal From: pollita@php.net ("Sara Golemon") > > > Yes I know that this is a small function and yes I know it can be copy-paste > > > with every new project you do but from the first day I've been using PHP > > > until today this function follows me everywhere and I now that everyone is > > > using it one way or the other for debugging...... > > ... > > > > The proper place to ask for new features is at http://bugs.php.net/. Click > > "report a bug" and choose "Feature/Change Request" as the "Type of bug". > > But don't bother - this was requested before and denied. > If you really-really want it on your own build, just apply this short patch. Index: ext/standard/basic_functions.c =================================================================== RCS file: /repository/php-src/ext/standard/basic_functions.c,v retrieving revision 1.713 diff -u -r1.713 basic_functions.c --- ext/standard/basic_functions.c 2 May 2005 12:12:04 -0000 1.713 +++ ext/standard/basic_functions.c 16 May 2005 18:00:25 -0000 @@ -2762,23 +2762,29 @@ /* }}} */ -/* {{{ proto mixed print_r(mixed var [, bool return]) +/* {{{ proto mixed print_r(mixed var [, bool return[, bool pretags]]) Prints out or returns information about the specified variable */ PHP_FUNCTION(print_r) { zval *var; - zend_bool i = 0; + zend_bool i = 0, pretags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var, &i) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|bb", &var, &i, &pretags) == FAILURE) { RETURN_FALSE; } if (i) { php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC); } + if (pretags) { + php_printf("
\n");
+       }

        zend_print_zval_r(var, 0 TSRMLS_CC);

+       if (pretags) {
+               php_printf("\n
\n"); + } if (i) { php_ob_get_buffer (return_value TSRMLS_CC); php_end_ob_buffer (0, 0 TSRMLS_CC);