note 60424 deleted from function.print-r by nlopess

From: Date: Fri, 06 Jan 2006 14:55:40 +0000
Subject: note 60424 deleted from function.print-r by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-101311@lists.php.net to get a copy of this message
Note Submitter: taylorbarstow at google's mail service ---- 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

« previous php.notes (#101311) next »