note 60424 added to function.print-r

From: Date: Fri, 06 Jan 2006 14:28:11 +0000
Subject: note 60424 added to function.print-r
Groups: php.notes 
Request: Send a blank email to php-notes+get-101309@lists.php.net to get a copy of this message
In my work with PHP, I've found that it would be very useful to have a function like print_r that allowed the caller to specify the depth to which the function would traverse, whether in an array, an object structure, etc. The motivation is that in an object oriented system, typically as a request is serviced, a larger and larger tree/graph of objects is created. var_dumping or print_ring any of these objects in effect dumps the entire structure, which can be nearly impossible to read. Does anyone know of a function that would allow the caller to specify the maximum depth to traverse to? Or perhaps an extension that accomplishes this? If not I will write one using PHP5's reflection API (where appropriate) and post it here. Thanks ---- Manual Page -- http://www.php.net/manual/en/function.print-r.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60424 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60424&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60424&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60424&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60424&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60424&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60424&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60424&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60424&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#101309) next »