Req #55149 [Opn->Sus]: Limit the result of print_r() to facilitate debugging

From: Date: Sun, 10 Sep 2017 21:07:21 +0000
Subject: Req #55149 [Opn->Sus]: Limit the result of print_r() to facilitate debugging
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211040@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55149&edit=1 ID: 55149 Updated by: cmb@php.net Reported by: victor at cmp dot es Summary: Limit the result of print_r() to facilitate debugging -Status: Open +Status: Suspended Type: Feature/Change Request -Package: Class/Object related +Package: Variables related Operating System: Irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Apparently, this proposal is controversial and as such would require an RFC, see <https://wiki.php.net/rfc>. Everybody is welcome to create a respective RFC; if you do so please refer to this feature request. In the meantime, I'm suspending this ticket. Previous Comments: ------------------------------------------------------------------------ [2012-01-23 22:54:00] gmblar+php at gmail dot com Try xdebug_var_dump http://xdebug.org/docs/all_functions#xdebug_var_dump for a limited output. ------------------------------------------------------------------------ [2011-07-07 02:31:49] lenzai2004-dev at yahoo dot com Why not writing your own custom php function for that purpose ? Also for debugging var_dump is sometimes more useful than print_r. ------------------------------------------------------------------------ [2011-07-06 11:51:03] victor at cmp dot es Description: ------------ You could add an additional third parameter to print_r() function in order to limit the nesting level of output. Instead of showing all levels of nested arrays/objects, it could be limited to N nesting levels. If I only want to know my simple class member variables (with 3 or 4 of them) of an object but the object has members with "references/alias" to other big objects/classes, the screen is filled with a lot of (in this case) useless information. If I could limit in this case the output to 1 or 2 nesting levels it would be much easier for me to debug. If this third parameter were ommitted or zero, the whole tree would be shown (as done now). ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55149&edit=1

« previous php.bugs (#211040) next »